If using a library on the client-side that expects data in a specific format (e.g. [{id: 1, name: "Jack", available: true}]), should the server process the data in the exact structure requested by the client or send back a generic data (e.g. [{userId: 1, username: "Jack", isUserAvailable: true}]) which can then be modeled on the client-side to avoid tight coupling and breaking if the client-side library changes in the future?
Should HTTP REST request to the Server return data in specific format expected by the Client?
85 Views Asked by ToDo At
2
There are 2 best solutions below
0
Michiel
On
If you have legacy systems or are unable to change formats or need to support specific clients which cannot be changed, then consider an API gateway that can do transforms for you at different endpoints.
But normally, model your API as open as possible. You can hardly define it for each different client there is out there.
Related Questions in REST
- Spring RestTemplate passing the type of the response
- .net rest service with JSON string and consumed with java client
- SuiteCRM how to retrieve all account related contacts
- http status code for failed email send
- cloud foundry - 413 Request Entity Too Large
- Why does PHP add "\r\n" to an empty string?
- WCF Service not accepting multiple body parameters
- How to send Rest GET request that contains "#" value in url parameters?
- Phalcon PHP - RESTful API
- Object of class CS_REST_Wrapper_Result could not be converted to string in CAMPAIGN MONITOR
- purchase individual items and subscriptions in the same PayPal REST API transaction
- Empty Response Received on Android POST Request
- angular load more tweets onclick
- Async vs Horizontal scaling
- Responding to an Office 365 event invite via REST
Related Questions in HTTP
- My get request for http is very slow
- Angular multiple http requests chrome android
- HttpRequestContext vs HttpContext
- Converting curl command to iOS
- getting google contacts using shuttlecloud
- Node.js http.get example
- How can hide url value in php
- Symfony2 - handle HTTP/Entity user access restrictions
- Angular http interceptor responseError doesn't have statusText
- Which of the following hostnames are valid?
- Send Http request at specific time
- Rails - read file from POST request / octet-stream
- Python - Cookies & BeautifulSoup
- Npm requests stopped by home router
- POST Android json data
Related Questions in SERVER
- How can I monitor an endpoint's status with Ruby?
- Rasterization with Javascript looks different on Apache server
- Netty loses udp packets at the beginning of the communication
- How to have Heroku build my development branch on a staging server?
- Timing packets on a traffic server
- copying file from local machine to Ubuntu 12.04 returning permission denied
- AWS EC2: Migrating from Windows to Linux Server
- Connecting Ms Access Db to Mysql through Vba
- Remove ".local" suffix on local server (Yosemite)
- Server program gets stuck at accept function
- PayPal API QueryParameters not found
- Python Server - Processing WebSocket.close()
- NameValuePair, HttpParams, HttpConnection Params deprecated on server request class for login app
- Unable to send file from ftp to another ftp
- Scala - TCP Packet frame using Akka
Related Questions in CLIENT
- Does javascript saves server's electricity?
- What client manager for postgres do you use? Phpmyadmin analog for postgres
- Haxe server-client exchange on all platforms
- Deploying Client/Server Java Application
- Python Multiplayer noughts and crosses
- Multithreaded Server in Java - connection timeout exception while connecting from other computer
- Meteor client call to server not returning data
- How I can send a object from Client to Server in Java?
- ShouldoverrideUrlLoading not called on samsung galaxy and HTC devices
- Simple client server to send XML information to CRUD database
- Python Networking
- How to create zip file with maven: Java Client + JRE
- Client side password hash versus plain text
- Why can't I send Serializable Object with ObjectOutputStream in Java?
- Communicating with WebSocket server using a TCP class
Related Questions in TIGHTLY-COUPLED-CODE
- Open sql connection in business service
- Tightly Coupled classes: what is better design in my situation
- How can you get unnecessarily tight coupling if you have too low encapsulation
- Implementing an interface is tight coupling?
- How to make data loosely coupled with application code?
- Will I be sorry for semi-decoupling my Layout from my Activity?
- Is usage of Nested classes and example of tight coupling?
- Should HTTP REST request to the Server return data in specific format expected by the Client?
- Is it worth trying to write tests for the most tightly coupled site in the world?
- Are self-described / auto-descriptive services loosely or tightly coupled in a SOA architecture?
- Should I go tightly coupled, with singleton, or loosely coupled, without a singleton? Azure Services, Xamarin Forms
- Simulate a coupled ordinary differential equation
- Cleanly passing options between coupled shell scripts
- What are the symptomps of tightly coupled objects?
- Game Objects Talking To Each Other
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Client have to depend towards the interface that the server provides, This interface can be seen as a contract that the server and client agree to. This does imply the data structures provided and is a form of coupling. Hence the need to clearly describe / define APIs and have a policy for versioning and obsoleting those.
So this may seem like a tight coupling at first glance, but does not have to be. Client and server may or may not use the same language / representation of the data. The client is free to do whatever it wants the with the JSON in this example. It may use all the data or just a single attribute. All of that is of no concern to the server. Similarly the client is not concerned with how the server has created this JSON string. Due to the service contract only describing the interface and the resulting freedom for server / client implementations the coupling can be considered loose (enough).