T
T
tigra2020-02-15 18:56:37
RESTful API
tigra, 2020-02-15 18:56:37

Are there any base practices when building a response in api?

There is an item resource and let's say it has methods:


GET item/{id} - get a specific item
GET item/top- get a list of popular
items GET item/search- search for items by parameters

When getting a specific resource, I need about 20 fields, all of them are properties of the entity, and when getting lists of items, I need only 5 fields, i.e. I don't need to drag all item properties for lists.

In fact, according to REST, should I observe the same form in all methods of this resource or only in CRUD methods?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Shamanov, 2020-02-15
@SilenceOfWinter

according to the resource, you should not have anything else, since this is literally a state transfer

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question