Source

What are REST APIs

  • For communicating between clients and servers
  • RESTFUL Web Service: Service that uses REST APIs to communicate

Benefits

  • Simple and standardised approach to communication, no complications with formatting data and requests
  • Industry used
  • Scalable and stateless, modifications can be made easily
  • High performance because it supports caching

Endpoints

  • Can look like this: (example website)/api/flavours
  • api just signifies that this is the api portion of the endpoint
  • flavours is known as a resource, signifies that we are working with the flavours resource in this REST API

Building blocks

  1. Request to the server by the client
  2. Response sent to the client by the server

Common actions with REST API

  1. CRUD (Create, read, update and delete) == HTTP Methods/Operations (POST, GET, PUT, DELETE)

Requests

Made of:

  1. Header
  2. Operation
  3. Endpoint
  4. Parameter/body

Response

In the form of JSON data