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?
86 views Asked by ToDo At
2
There are 2 answers
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
- Query parameter works fine with fastapi application when tested locally but not working when the FastAPI application is deployed on AWS lambda
- Add an http GET/POST entry point to a Django with channels websocket
- Difficulty creating a data pipeline with Fabric Datafactory using REST
- Flutter connection to a local api
- Accessing REST API Status Codes using Azure Data Factory Copy Activity (or similar)?
- Mass Resource deletion in REST
- why when I check endpoint /tasks, an error always appears "error : invalid token" even though I have entered the appropriate token that I got
- How to prevent users from creating custom client apps?
- How to create a REST API with .NET Framework?
- Efficiently Handling Large Number of API Calls with Delphi 10.4 and OmniThreadLibrary
- Put Request throwing 401 [no body] Unauthorized
- Converting img src data to octet-stream
- Implementing Email Verification and Notification System in a Full-Stack Application with React Frontend and Node Backend
- Micronaut - Add Controller from external library
- Moving Template or OVA to Datastore using vCenter API
Related Questions in HTTP
- Handling both JSON and form values in POST request body with unknown values in Golang
- Why can't I use PUT requests?
- nginx set up reverse proxy from subfolder to a port
- Async Web Server RP2040 returning ERR_CONNECTION_REFUSED?
- Getting `FormatException: Missing extension byte (at offset 6)` exception for accessing `response.body` from a server deployed in Vercel
- Retrieving list of values from MYSQL data base based on input value(LARAVEL 10 )(GET HTTP METHOD)
- Unable to add request headers via CHttpFile - C++/MFC
- Why do we call all http services 'Web Api/Web Service'?
- How to correctly read POST REQUEST body on ESP32?
- on linux gitclone issue remote server error showing fatal error with proxy n port
- Elasticsearch - cascading http inputs from Airflow API
- How to clean the html pages opened in a session?
- UTF-8 is not a valid encoding name
- I dont get the Result i expected when i want to get my Telegram Chatbot id
- NextJS 14 SSE with TransformStream() sending messages in a single response
Related Questions in SERVER
- Sending data from C++ server to React.js client
- Deploy Flutter and Laravel php mobile app on the host server
- Protect Server Actions with Next Auth in Next JS 14
- Cannot interact with netcat server over distance
- Facing fatal errors while running "yum update" command on CentOS 7/Cloudlinux 7
- Is there any way to set a printer as default according with Active Directory Policy Security Group and PC hostname?
- How to run GRPC and REST server on same port in Go?
- Share files from the server without data or internet usage
- Django Not Sending Tasks to Celery in Production
- Install Postfix Mail Server
- Is it viable proxying all my mobile apps requests, to some kind knowing that a request is coming from a secure source
- How does a server handle multiple requests, and how does is know where to send which response?
- Trying to launch batch file from powershell, and immediately closes
- Apache: How can I redirect to a subfolder with a URL param but serve required content via the main URL?
- Developing on a remote server an app symfony
Related Questions in CLIENT
- Echo behaviour of Microsoft Windows Telnet Client
- Client in C# using Sockets
- NEXTJS14 DRIZZLE : Async issue when trying to post data from component into DB
- how to get rid of cannot access a closed pipe exception in C#
- Running a web application from external network client pc
- How to communicate between a server side and client side component in Next.js
- Server side rendering and client side rendering
- Can not send data from client to server
- Flask: Sending File Between Two Servers Results in Empty `request.files` on Receiver Server
- GittyUp - Git-Client: Unable to see the changed files list on the right of the `Diff` window
- my epoll server can not detect client disconnection
- getting client IP address in a webserver
- Socket returning empty data
- Error after ending code that use tkinter with thread
- HTML file and client side storage Javascript related question, is it possible?
Related Questions in TIGHTLY-COUPLED-CODE
- Does server-side authentication in ReactJS or any frontend result in tight coupling with the backend?
- Why MVP still considered tightly coupled even contract(interfaces) are used
- OpenMDAO hierarchical solvers recording
- tight coupling and loose coupling examples with Java code
- How does Spring Framework choose between two components?
- Simulate a coupled ordinary differential equation
- java void functional programming, tight coupling and boilerplate
- Tight coupling and ES6 modules
- Can tight coupling also include interface?
- Should HTTP REST request to the Server return data in specific format expected by the Client?
- Is it acceptable for a class to have its properties used ONLY by the outside environment?
- Should I go tightly coupled, with singleton, or loosely coupled, without a singleton? Azure Services, Xamarin Forms
- Is usage of Nested classes and example of tight coupling?
- How to instruct Spring to Autowire a field in a chain of tightly coupled objects
- OOP Tight Coupling. When should I do it?
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?
Popular Tags
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)
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).