Skip to content

HTTP response for empty list #31

@rbroth

Description

@rbroth

Hi,
I'm trying to download a list of all IGSNs for a user code (https://app-sandbox.geosamples.org/samples/user_code/UKB?page_no=0). However, I have more than 50000 samples. When I increase the page number until there is no data (e.g. https://app-sandbox.geosamples.org/samples/user_code/UKB?page_no=99999), the server returns a 404 HTTP error. I believe this is incorrect, since the resource (i.e. the collection of IGSNs) has been sucessfully found, but due to the filtering criteria, is an empty set. The server should instead return HTTP response code 200 and an empty list.

StackOverflow discussion about this: https://stackoverflow.com/questions/13366730/proper-rest-response-for-empty-table

Practically, my problem is that I cannot reliably know when I have reached the end of the result set pages vs there is an error with the server. So, my suggested fixes are either:

  1. Change it so that a successful query with an empty resultset returns HTTP response code 200
  2. Add an endpoint to return the total number of samples by usercode (e.g. /v1/igsns/total/usercode?usercode=UKB) so I can figure out how many pages with data to expect

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions