Answer the question
In order to leave comments, you need to log in
Is it against the principles of RESTful services to receive mixed data?
Task
There is a server and there is a client. The client needs to receive from the server a list of supermarkets and promotions that are currently held in these supermarkets.
Solutions
Solution #1
GET http://myservice.com/markets
GET http://myservice.com/discounts
GET http://myservice.com/markets_and_discounts
Answer the question
In order to leave comments, you need to log in
It is possible to connect supermarkets with stocks on the backend side through a connection like "has many" or "many to many", depending on what logic you have there.
Make a request for GET http://myservice.com/markets
with some parameter.
For example, http://myservice.com/markets?expand=discount
and accordingly, if there is expand
also its value discount
, make a selection of all supermarkets and corresponding stocks for each supermarket and return all the data at once.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question