SpaceX-API icon indicating copy to clipboard operation
SpaceX-API copied to clipboard

Request for offset in endpoints

Open jeroenboumans opened this issue 8 years ago • 6 comments

Hi @jakewmeyer,

Would it be possible to add an offset option in the request that can be used for pagination? Currently limit is an option but no offset can be given with the request. This way the impact of the launches query can be optimised in performance and load on both client and server side.

For example:

  • Return the 3rd set with as size of 5 results of all launches: https://api.spacexdata.com/v3/launches?offset=2&limit=5

  • Return the first set with as size of 5 results of all launches: https://api.spacexdata.com/v3/launches?offset=0&limit=5 https://api.spacexdata.com/v3/launches?limit=5

Cheers! Jeroen

jeroenboumans avatar Dec 01 '18 15:12 jeroenboumans

Should be easy to add 👍

I have finals until Wednesday, so I should be able to add this later in the week.

jakewmeyer avatar Dec 01 '18 23:12 jakewmeyer

Thanks again @jakewmeyer, appreciate it! Good luck with your finals! 👍🎉

jeroenboumans avatar Dec 03 '18 12:12 jeroenboumans

Added and live 👍

https://api.spacexdata.com/v3/launches?limit=1&offset=5

Available on any endpoint that can return multiple results. Docs have been updated as well.

jakewmeyer avatar Dec 05 '18 06:12 jakewmeyer

Awesome and thanks @jakewmeyer! 👍 Time to update some scrollviews!

Sidenote: it's awesome how much faster this loads :)

jeroenboumans avatar Dec 05 '18 08:12 jeroenboumans

Shouldn't you close this issue then? @jakewmeyer

felipediogo avatar Dec 05 '18 13:12 felipediogo

Yes, hadn't seen it until now

@jeroenboumans sounds good 👍

jakewmeyer avatar Dec 05 '18 13:12 jakewmeyer