Thursday 15 March 2012

REST API design agregate -


If we are creating APIs on employee management ap then there is a schedule in the interface, where we will be in the table for every user in line All changes have to be shown forward, there is a summary for each user (per line) and day (per column). Do we have a large gross call like:

  received / api / locations / {id} / shedule  

return all employees, changes, summaries Will give etc. Or perhaps we should break several collections such as:

  received / api / locations / {id} / files / api / locations / {id} / events gET / api / locations / {id} / Summary GET / API / Employee / {ID} / Summary? Date_from = {date_from} and date_from = {date_to}  

For me, the second option is more flexible and there is no reason to create a new abstract resource, which is scheduled in my opinion Is part of the interface layer and should not have any effect on the API design.

On the other hand, the larger gathering is more optimal, because there will be less database database and easier in cache. / P>

How do you feel? Is there a source, the type of article that I can trust?

There is nothing or either calm or unaware about the approach. URI semantic is irrelevant to REST. What really matters is that how do customers receive URIs if they are looking at URI patterns in documents and APIs are not cool to fill the price instead of using the links.

With that in mind, I would say that the approach that is more relevant to your business is the best ecosystem of your applications. If you feel the need, do not be afraid to make gross resources.


No comments:

Post a Comment