Single-entity resources such as PUT /data/sales/1 or GET /data/products/BARCODE1 give the API too many unnecessary boilerplate interfaces.
A good alternative are query parameters, which allow both types of resources (single-entity and multi-entity) to coexist and work under the same path. With query parameters, one can call PUT /data/sales?id=1 instead of PUT /data/sales/1 and GET /data/users?roleCode=customer?pageSize=1 to perform all desired operations.
Single-entity resources such as
PUT /data/sales/1
orGET /data/products/BARCODE1
give the API too many unnecessary boilerplate interfaces. A good alternative are query parameters, which allow both types of resources (single-entity and multi-entity) to coexist and work under the same path. With query parameters, one can callPUT /data/sales?id=1
instead ofPUT /data/sales/1
andGET /data/users?roleCode=customer?pageSize=1
to perform all desired operations.Originally posted by @bglamadrid in https://github.com/trebol-ecommerce/trebol-api/issues/16#issuecomment-910729136