What is REST API?

A web API designed according to the principles of REST. It represents the things it handles as resources identified by URLs and expresses operations with HTTP methods: GET to retrieve, POST to create, PUT or PATCH to update and DELETE to delete. Each request is stateless and contains all the information needed to process it, and data is often represented in JSON. Results are returned with HTTP status codes; for example, a successful creation returns 201 Created.

Japanese name: REST API

REST API appears in 1 practice question across 1 topic, including Web Technology Basics.

Field: Web Technology Basics

Try it: questions about REST API

Which of the following is an appropriate web API design that follows the principles of REST?

  1. APut the operation name into the URL, as in /getUser?id=42 or /deleteUser?id=42, and send everything with GET
  2. BRepresent a user resource with a URL such as /users/42 and express operations with HTTP methods, such as GET to retrieve and DELETE to delete
  3. CHave the server remember each client's earlier requests, so that the next request only sends a short command that depends on them
Show answer and explanation

Answer: B. Represent a user resource with a URL such as /users/42 and express operations with HTTP methods, such as GET to retrieve and DELETE to delete

In REST, the things being handled are represented as resources identified by URLs, and operations on them are expressed with HTTP methods such as GET (retrieve), POST (create), PUT or PATCH (update) and DELETE (delete). For example, GET /users/42 retrieves a resource, and when POST /users creates a new user, the server returns 201 Created with the URL of the new resource. Each request is made stateless, containing all the information needed to process it. If an operation such as deletion is done with GET, data may be lost merely because a browser fetches links in advance or a crawler visits.

REST API in the explanations

Questions that mention REST API (1)

  1. Which of the following is an appropriate web API design that follows the principles of REST?

Books on Web Technology Basics Ad

As an Amazon Associate I earn from qualifying purchases.

Related terms

HTTP method Cookie (HTTP cookie) CORS (cross-origin resource sharing) DOM (Document Object Model) Event loop HTTP (Hypertext Transfer Protocol) HTTP status code JSON (JavaScript Object Notation) JWT (JSON Web Token) OAuth

Back to the glossary