raiden
raiden copied to clipboard
API - return null values instead of 404 if no query-entities are found
trafficstars
Abstract
The e.g. GET /channels/ endpoint provides an endpoint for a set of all channels the node is connected to.
It provides further filtering with token and partner_address URI parameters - filtering the resulting set of entities.
In my opinion, when the user queries e.g. /channels/<token_address>/<partner_address> and no channel exists, the empty set [ ] should be returned instead of a 404 status code.
Motivation
The reasoning behind this:
- The
/channelsendpoint is an endpoint for a set of entities, it does not refer to a unique resource like e.g.GET /channel/<id>would 404status codes usually imply user/client error- the
/channelsresource exists, but has no entities in it for the specific query ("empty database table, but the table exists")
Backwards Compatibility
Probably not backwards compatible, since this concerns the public API, and API consumers could already be catching the 404 error in order to handle missing channels.
We could also return 404 and an empty list at the same time.