Let's suppose that I have a model named Collection
. I can create a collection
, this collection have two important fields: shared_with_company
, shared_list
.
currently I have an endpoint: /collections
and this endpoint returns something like it:
{
shared_with_company:{collections: ..., count: 5}
shared_list:{collections: ..., count: 12}
my_collections:{collections: ..., count: 20}
}
but, in the frontend the user want to paginate just my_collections or shared_list or shared_with_company. Should I create a specifics endpoints to each type of collections? Remember, everytime the user load the collections page will show 12 (max per page) collections of each (my_collections, shared etc.), and then he will be able to paginate it. I don't know if this is the best way to do it, I think a lot of users send 3 requests everytime the page is loaded.
Another approach: use an endpoint to load the initial page, and this endpoint will make one request to the first page and the paginations will be made with different endpoints.
I really don't know if there is a better approach or something like that.
I don't know if this can help, but I currently using Django + Django Rest Framework.