This repository has been archived by the owner on Dec 22, 2022. It is now read-only.
As a paginator, I want endpoints to consistently return no results when I page to the end of results #69
Labels
Milestone
Various API endpoints like the
/collections/{lidvid}/products
let you paginate through your results in a fairly direct manner:start
to zero and yourlimit
to 20.start
to20
and try again.start
to22
and try again.For example, try this:
curl --header 'Accept: application/json' 'https://pds-gamma.jpl.nasa.gov/api/collections/urn%3Anasa%3Apds%3Ainsight_documents%3Adocument_hp3rad%3A%3A8.0/products?start=0&limit=20&fields=product_class&only-summary=false' | json_pp
and note that thedata
field has 2 entries in it.start
to 2 trycurl --header 'Accept: application/json' 'https://pds-gamma.jpl.nasa.gov/api/collections/urn%3Anasa%3Apds%3Ainsight_documents%3Adocument_hp3rad%3A%3A8.0/products?start=2&limit=20&fields=product_class&only-summary=false' | json_pp
and you get this nice little result:🍻 Perfect!
This strategy worked with the various other endpoints too, like
/bundles/{lidvid}/collections
. Or it used to. Now (possibly related to the fix for NASA-PDS/pds-api#73) this no longer works for/bundles/{lidvid}/collections
. Instead of returning zero results, it gives a 500 Internal Server Error.For example, try this:
curl --header 'Accept: application/json' 'https://pds-gamma.jpl.nasa.gov/api/bundles/urn%3Anasa%3Apds%3Ainsight_documents%3A%3A2.0/collections?start=0&limit=20&fields=product_class&only-summary=false' | json_pp
. Note thedata
parameter has 5 entries.start
to 5 and docurl --header 'Accept: application/json' 'https://pds-gamma.jpl.nasa.gov/api/bundles/urn%3Anasa%3Apds%3Ainsight_documents%3A%3A2.0/collections?start=5&limit=20&fields=product_class&only-summary=false' | json_pp
. Now you get this:😭 What happened? This used to work.
On a possibly related note, asking for zero items (
limit=0
) also used to work; you'd get back adata
entry that was an empty array, which is what you'd expect. Now you get 500 Internal Server Error—and on multiple endpoints. I think you should be able to ask for nothing and get nothing, which is not an error condition 😅The text was updated successfully, but these errors were encountered: