less than 1 minute read

Overview

  • REST: Representational State Transfer. Its a Architectural style for the web(makes use of HTTP).
  • Key Abstraction: Resource. and Resource has URI(Uniform Resource Identifier). ex: /books/Joseph Murphy -> /books/{Author}. we can perform actions on resources like Retrive/Add/Update/Delete Books
  • MappingJackson2HttpMessageConverter this jackson mapper will by default convert the bean into json.

REST API Methods

  • GET: Retrieve details of a resource.
  • POST: Create a new Resource.
  • PU: Update an existing resource.
  • PATCH: Update part of a resource.
  • DELETE: Delete a resource.

Response Status for REST API

  • Return the correct response status
  • Resource is not found ==> 404
  • Server exception ==> 500
  • Validation error ==> 400

Important Response Statuses

  • 200: Success
  • 201: Created
  • 204: No Content
  • 401: Unauthorized(when authorization fails)
  • 400: Bad Request(such as validation error)
  • 404: Resource Not Found
  • 500: Server Error