KIM COMPUTER


Understanding REST API (Representational State Transfer API)

A REST API is an interface that follows the principles of REST, an architectural style designed to take full advantage of the existing protocols of the Web. It focuses on identifying resources by names and transferring their states.


1. The Three Elements of REST API

A REST API is defined by three core components:

  1. Resource - URI: Every resource is identified by a unique Uniform Resource Identifier (URI).
    • Example: /users/123 (User with ID 123)
  2. Verb - HTTP Methods: Defines the action to be performed on the resource.
    • GET: Retrieve data (Read)
    • POST: Create new data (Create)
    • PUT/PATCH: Update existing data (Update)
    • DELETE: Remove data (Delete)
  3. Representation: The format in which the server returns data to the client, most commonly JSON or XML.

2. Key Characteristics of REST


3. What is "RESTful" Design?

An API is called RESTful when it strictly adheres to the constraints of the REST architecture. * Bad Example: GET /get_user_info/123 (Includes a verb in the URI) * RESTful Example: GET /users/123 (Identifies the resource with a noun and expresses the action via the HTTP method)