Restful and HTTP - martinbalke-401-adavanced-js/seattle-javascript-401n14 GitHub Wiki

Reading for class 06 Restful and HTTP

Restful is an architectural model for how to build web applications. It stands for representational state transfer model. The main objective of a Restful API is to expose end points at a web address that allow you to perform basic CRUD operations on a database.

The basic structure of a restful API is as follows

GET

Get requests are made to an endpoint generally to read information from the database. Most of the time these requests will respond with JSON data

POST

Post requests are made to an endpoint to create data in the database. Generally the body of your request will also contain some information you would like to insert in to the database or API.

PUT

Put requests are made to an endpoint in order to update some kind of data. Generally you will also send along an ID for that data that you would like to change as well as the actual values of the updated fields.

DELETE

Delete requests are made to an endpoint in order to delete data. These by design should include an id for the data you would like to delete.