Difference between revisions of "REST - Wendy's 4 for 4"

From Coder Merlin
Line 1: Line 1:


== Overview ==
== Brief Overview ==
REST  API or RESTful API stands for REpresentational State Transfer
REST  API or RESTful API stands for REpresentational State Transfer



Revision as of 10:36, 20 August 2021

Within these castle walls be forged Mavens of Computer Science ...
— Merlin, The Coder

Brief Overview[edit]

REST API or RESTful API stands for REpresentational State Transfer

An API is a means of communication with a server. Whenever you browse something on the internet, your browser will ask the server for data. The server will then present the data; an API handles the data transfer between your device and the server.

The rest API works with the client and server. The client will send data through a request, and the server will send the data back in the form of a response.

Components[edit]

  • Resource Path

Resource path is the “request target” or the desired destination for the object. For example, a resource path could be “codermerlin.com/wiki/database/grades” where the object would be sent to the grades directory of the host.

  • HTTP Verb

With an HTTP Verb, the actions of the resource could be easily defined. A handy acronym to remember the available HTTP Verbs is “C R U D” or Creation (creates a resource), Retrieval (retrieves a resource), Update (updates a resource), and Deletion (deletes a resource).

  • Body

The body is the contents of the resource, and conveniently uses the JSON (JavaScript Object Notation) as the format. Both Creation operations and Update operations contain a body, but a Retrieval operation does not contain a body. In addition, the Deletion operation would also not contain a body.

  • Header

A header in short is simply a description of the resource, essentially acting as a metadata for the resource.

Usage[edit]

Concepts[edit]

Restrictions[edit]

Sources[edit]