Skip to content

Instantly share code, notes, and snippets.

@ross-u
Created May 15, 2020 06:49
Show Gist options
  • Save ross-u/08d7a32bca083291bcbe895f2425b477 to your computer and use it in GitHub Desktop.
Save ross-u/08d7a32bca083291bcbe895f2425b477 to your computer and use it in GitHub Desktop.

REST API

Representational State Transfer


REST is a design pattern (for APIs) and describes how network resources are accessed.

REST is not a standard nor a protocol.

By using a REST interface, different clients can hit the same REST endpoints, perform CRUD actions via HTTP mehods.

This architecture pattern makes the interaction between a client and a server uniform with a well-defined API, so that different clients (OS and browsers can all work with the API in the same way).


URL HTTP verb Request body Action Success Status Code
/api/projects GET (empty) Returns all projects 200 OK
/api/projects POST JSON Creates a new project 201 Created
/api/projects/:i GET (empty) Returns the single project 200 OK
/api/projects/:i PUT JSON Edits the projects 200 OK
/api/projects/:id DELETE (empty) Deletes the projects 204 No Content

**HTTP methods are what defines operations in well-formed REST APIs, not the URLs. **

URLs should not contain verbs.


When we want to retrieve, modify, or delete a record, we operate by making the request and using the correct HTTP method.


Well-designed REST APIs must provide response status code that makes it clear there is a problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment