2xx – success

The variations of 2xx status codes, which represent success scenarios, can be compressed into four main 2xx status codes:

  • 200 OK: This is the most common happy path response, indicating that the request succeeded.
  • 201 Created: This indicates that a new resource has been successfully created. It is most commonly used as a response to POST request methods. This response should contain a location header, which provides the URL for the new resource that has been created. There is a recommendation to send the response body back with the newly created resource. Essentially, the response body is the same if the consumer hits the GET endpoint to retrieve the resource.
  • 202 Accepted: This is kind of equivalent to 201. The only difference is that 202 is used for asynchronous operations, as it clearly indicates eventual consistency.
  • 204 No Content: This is also similar to 200, but only when there is no response body. This is mostly used for DELETE requests.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.129.19.251