Proposed update of rule 2 to include all HTTP Status Codes to use. See also issue #287.
Rule 2 - HTTP Status Codes
The following HTTP Status Codes MUST be used for the specified cases below..
GET a list of items
200 OK, when items found.
200 OK with an empty collection, when no items found,
400 Bad request
GET details of an item
200 OK, when the item is found
404 Not Found, when the item is not found
400 Bad request
PUT to create an item
201 Created with no reponse body, when created successfully.
400 Bad request
PUT to replace an existing item
204 No Content with no response body, when replaced successfully.
400 Bad request
How to handle an empty collection
An empty collection MUST be returned with HTTP Status Code 200 OK. The HTTP response message body MUST contain the standard pagination envelope, where the total count is set to 0, and the collection array property is present and empty.
This ensures consistent response structures and simplifies client handling. The schema enforces this behavior by explicitly allowing an empty array (minItems: 0).
Proposed update of rule 2 to include all HTTP Status Codes to use. See also issue #287.
Rule 2 - HTTP Status Codes
The following HTTP Status Codes MUST be used for the specified cases below..
GET a list of items
200 OK, when items found.200 OKwith an empty collection, when no items found,400 Bad requestGET details of an item
200 OK, when the item is found404 Not Found, when the item is not found400 Bad requestPUT to create an item
201 Createdwith no reponse body, when created successfully.400 Bad requestPUT to replace an existing item
204 No Contentwith no response body, when replaced successfully.400 Bad requestHow to handle an empty collection
An empty collection MUST be returned with HTTP Status Code
200 OK. The HTTP response message body MUST contain the standard pagination envelope, where the totalcountis set to 0, and the collection array property is present and empty.This ensures consistent response structures and simplifies client handling. The schema enforces this behavior by explicitly allowing an empty array (
minItems: 0).