The HTTP verbs and HTTP response status code

We are going to use the first four of the most commonly used HTTP verbs for Create, Read, Update and Delete (CRUD) operations:

  • GET: This method retrieves an existing resource. It returns 200 OK if the resource exists, 404 Not Found if it does not exist, and 500 Internal Server Error for other errors.
  • PUT: This updates a resource. It returns 200 OK if successfully updated, 201 Created if a new resource is created, 404 Not found if the resource to be updated does not exist, and 500 Internal Server Error for other unexpected errors.
  • POST: This creates a resource with an identifier generated at the server side. It returns 201 CREATED if a new resource is created, 200 OK if the resource has been updated successfully, 409 Conflict if the resource already exists and an update is not allowed, 404 Not Found if the resource to be updated does not exist, and 500 Internal Server Error for other errors.
  • DELETE: This deletes a resource. It returns 200 OK or 204 No Content if the resource has been deleted successfully, 404 Not Found if the resource to be deleted does not exist, and 500 Internal Server Error for other errors.
..................Content has been hidden....................

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