cc-api-v3-style-guide icon indicating copy to clipboard operation
cc-api-v3-style-guide copied to clipboard

related resource proposals does not address pagination

Open dieucao opened this issue 11 years ago • 6 comments

nesting of related resources needs to have a way to paginate the related resources. For example, if you want to get all the spaces for an org or all the routes for an app.

dieucao avatar Aug 07 '15 06:08 dieucao

We have created an issue in Pivotal Tracker to manage this. You can view the current status of your issue at: https://www.pivotaltracker.com/story/show/100796616.

cf-gitbot avatar Aug 07 '15 06:08 cf-gitbot

perhaps mvp is to have a maximum of a given resource, if the amount exceeds the request we return an error and point the user to the nested endpoint which has pagination already included.

it also may be appropriate to only enable related resource inclusion for relationships we know will be safely capped

zrob avatar Aug 07 '15 15:08 zrob

From second cage match:

Maybe cut off after 20/50 and return nothing with link to paginated endpoint? Mechanics uncertain. Not sure how common pagination will be needed if we limit including resources to reasonable endpoints.

Gerg avatar Aug 17 '15 15:08 Gerg

Also this thread may be useful: https://github.com/json-api/json-api/issues/509

Gerg avatar Aug 17 '15 15:08 Gerg

GET /v3/apps/123?include=routes

{
  "guid": 123,
  "included": {
   "routes": {
      "resources": [{"guid": 1}, {"guid": 2}],
      "links": {
        "related": "/v3/apps/guid/routes"
      },
     "pagination": {
       "next": {
         "href": "/v3/apps/guid/routes?page=2"
       }
     }
  }
}

Pagination should be something like this. This is the same as how we paginate our other collections.

Gerg avatar Aug 21 '15 21:08 Gerg

Finished. Added a section for paginating related resources. 7e9913c

:8ball:

jeffpak avatar Aug 26 '15 23:08 jeffpak