DEV Community

Cover image for Essais on REST API
Halil Can Ozcelik
Halil Can Ozcelik

Posted on

Essais on REST API

REST (Representational State Transfer) is based on HTTP. I will write some basic information about the REST API. It is not a structured REST explanation, I will write down some notes about it.

If a request is cached, the response can be sent from one of the intermediaries (Proxy or Gateway) without reaching to server.

REST Methods

  • GET: Retrieve information about the REST API resource
  • POST: Create a REST API resource
  • PUT: Update a REST API resource wholly
  • DELETE: Delete a REST API resource or related component
  • PATCH: Update a REST API resource partially or wholly
  • HEAD: Identical to GET requests but only returns HTTP headers
  • OPTIONS: Describes the communication options for the target resource
  • CONNECT: Establishes a tunnel to the server identified by the target resource
  • TARGET: Performs a message loop-back test along the path to the target resource

And here are some helpful information about various REST methods:

  • GET requests can be cached POST requests never cached
  • GET requests to remain in browser history POST request does NOT
  • GET request can be bookmarked POST requests can NOT
  • GET requests to have length restrictions POST request have NOT
  • PUT requests insert or update a record depending upon whether the given record exists
  • PATCH requests set or update selected properties only and NOT the whole data.
  • Idempotent requests: Making multiple identical requests has the same effect as making a single request.
  • POST, CONNECT and PATCH methods are NOT idempotent.
  • GET, HEAD, OPTIONS, PUT, DELETE and TRACE methods are idempotent.

For more information, I suggest you visit the related page in W3C and the related Mozilla Developer Network page.

Top comments (0)