Introduction to REST API

What is REST? Representational State Transfer

  • Stateless communication
  • Uses HTTP methods
  • Resource-based URL

HTTP Methods Overview

Common methods for REST APIs:

  • GET - Retrieve resource
  • POST - Create resource
  • PUT - Update resource
  • DELETE - Remove resource

Example Request

GET /api/users/123 HTTP/1.1
Host: example.com
Authorization: Bearer <token>
        

This retrieves the user with ID 123.