What is REST API?

REST is a set of rules for building APIs. Most web APIs you use are REST APIs.

Picture: A waiter taking an order in a restaurant, representing the client-server relationship.

REST stands for Representational State Transfer. That sounds fancy, but the idea is simple. Every resource (a user, a product, an order) has a unique address (a URL). You use standard HTTP methods to interact with it.

Picture: A table showing HTTP methods: GET (read), POST (create), PUT (update), DELETE (delete).

  • GET to read data. GET /users/123 gets user number 123.
  • POST to create new data. POST /users creates a new user.
  • PUT to update data. PUT /users/123 updates user 123.
  • DELETE to remove data. DELETE /users/123 deletes user 123.

Picture: A Postman screenshot showing a GET request and a JSON response.

REST is popular because it’s simple and predictable. Every REST API works the same way. Once you learn one, you can use any of them. That’s why it became the standard for web APIs.

Picture: A smartphone showing multiple apps (Twitter, Spotify, Weather) all making REST API calls.