speedruncomorg / api

REST API Documentation for speedrun.com
346 stars 36 forks source link

Misdocumented `GET /games` and `GET /runs` query parameters note #136

Open exodustx0 opened 2 years ago

exodustx0 commented 2 years ago

Stated in the GET /games documentation:

Note that giving invalid values for platform, region or moderator will result in an HTTP 404 error instead of an empty list. This is on purpose, because asking to filter by non-existing elements should be something an API client should notice.

Let me start out by saying that the error should've been HTTP 400 instead of HTTP 404.

It's weird for only specific resource filters to check for invalid IDs. Turns out, all of gametype, platform, region, genre, engine, developer, publisher and moderator do indeed act the same way, so the documented list of validity-checked filters is incomplete. Note that GET /runs doesn't have this error.

Now, the real issue: turns out, if you query for an invalid ID through any of the above filters, the filter gets ignored completely instead of triggering an HTTP 404 (or HTTP 400) error.