Skip to content

Search API should return 400 when passed bad message body and not fall through to a default return value #58

@roncanepa

Description

@roncanepa

For example: I wrote a request and accidentally did not form the rq object correctly:

# note: this is NOT correct
curl --location --request GET 'https://search.idigbio.org/v2/summary/count/records/' \
--header 'Content-Type: application/json' \
--data-raw '{"recordset": "b40e13f7-a79a-4265-93d9-3b4878dfc988"}'

The expected value is (at time of this issue) ~130k. Instead, we get a return value of 128M. The search api should have noticed that a body was passed as part of the request, that it was malformed, and then returned http 400 instead of returning the total count of all records in iDigBio instead.

Example of correct query:

curl --location --request GET 'https://search.idigbio.org/v2/summary/count/records/' \
--header 'Content-Type: application/json' \
--data-raw '{"rq": {"recordset": "b40e13f7-a79a-4265-93d9-3b4878dfc988"}}'

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