REST API Tutorial

4 min read

An API (Application Programming Interface) is what lets two different software applications talk to each other. It defines the methods and data formats one program can use to request information from, or exchange information with, another program.

REST (REpresentational State Transfer) is an architectural style for building networked applications. A RESTful application uses HTTP as a stateless client-server protocol, and it relies on standard HTTP requests to perform CRUD operations (Create, Read, Update, Delete) on resources, typically returning data in JSON or XML format.

Client and server communicating via a REST API
A REST API lets a client and server exchange data over HTTP.

An API that follows the REST architectural style is called a RESTful API, or simply a REST API. A key property of these APIs is that they are stateless — neither the client nor the server stores information about the other between requests, and each request/response exchange is handled completely independently of any other. REST APIs rely on the standard HTTP methods and can work with a variety of data formats.

HTTP Methods Used in REST

REST APIs rely on five main HTTP methods:

  • POST — creates a new resource (the “Create” in CRUD).
  • GET — retrieves information about a resource; it is considered a safe method because it does not change anything on the server (the “Read” in CRUD).
  • PUT — replaces an existing resource’s content entirely (the “Update” in CRUD).
  • DELETE — removes a resource (the “Delete” in CRUD).
  • PATCH — applies a partial modification to a resource, rather than replacing it entirely.

The first four of these methods are what give CRUD (Create, Read, Update, Delete) its name. A simple way to remember the distinction between the two update-like methods: PUT is for updating, POST is for creating.

// members only

The rest of this article is for members

The full walkthrough, configuration examples and verification steps are available exclusively to paid members.

View membership plans Log in