How should API handle invalid inputs?
We have had a few complaints about a "bug" from customers who pass a page number query to an API endpoint that does not support it (e.g. Roles). They were expecting to receive a 404 since there is no "page 2" of Roles. Vanilla simply ignores the page number request. Other APIs (Salesforce, for example) will return an error when the endpoint does not support a query parameter. I find that to be very annoying, personally.
Is there a standard way that we should be handling this? Is it a matter of opinion?
Comments
-
We have an open issue to allow pagination on that API endpoint.
The way forward is definitely to add pagination to the endpoint. Until then, maybe read the docs and see what params are supported?
I personally think it's better to tell you theres an error in your API call w/ the current version that you are calling, then to have people passing extra params that may do nothing now (and they don't know) and then we make an update in the future that breaks the way they are calling it.
This way you know immediately, while you're writing your automation script if you are giving correct inputs or not.
0