An HTTP 2xx response indicates that the server successfully received, understood, and processed a request. Codes from 200 through 299 form the success class, allowing consumers to interpret unfamiliar codes by their class. section 4.5.1
Choose a specific success status according to the operation’s output and HTTP method:
- Return 200 OK when a successful read, search, or update returns data. section 4.5.3 section 4.9
- Return 201 Created for successful resource creation, and 204 No Content when an operation succeeds without response data, such as deletion. section 4.9
- Prefer assigned, commonly used status codes; avoid unassigned codes because they create compatibility problems and confusion. section 4.5.2
Shopping API and webhook acknowledgments
A consumer requesting GET /products/{Product reference} typically receives 200 OK with product details. A webhook receiver may return 200 OK or 204 No Content after successfully receiving an event; it should respond quickly and need not return data. section 4.5.3 section 14.6.7
Figure 4.12 An HTTP status has a numeric code and human-readable reason. The class system allows for easily identifying whether the code signifies a success or an error and who is at fault.
Use the status-code diagram to distinguish the numeric code, human-readable reason, success class, and likely party responsible for an error. section 4.5.1
