Introduction to REST API
REST API is a set of rules that developers must follow when developing APIs. REST is an acronym that stands for Representational State Transfer. It is a networked application design architectural style. HTTP requests are used by REST APIs to GET, PUT, POST, and DELETE data. REST APIs are stateless, which means the server does not maintain any data (state) between requests. REST APIs are thus scalable and simple to maintain. REST APIs are also simple to understand and apply. REST APIs are the most commonly used method for developing APIs.
REST API Example
Let’s take a look at a simple REST API example. We will use the JSONPlaceholder API, which is a fake online REST API for testing and prototyping. The API has a set of endpoints that return different types of data. For example, the
/posts endpoint returns a list of posts, and the
/posts/1 endpoint returns a single post with the ID of 1. The API also has endpoints for users, comments, and todos. You can find the full list of endpoints in the documentation.
1. Write an Article about REST API
Create a REST API article. The following information should be included in the article:
- What exactly is REST API?
- What are the benefits and drawbacks of REST API?
- What are the drawbacks of REST API?
- Which are the most widely used REST API testing tools?
- Which are the most widely used REST API documentation tools?
2. On Paper or Whiteboard, Draw a Diagram of a REST API
Create a REST API diagram. The following elements should be included in the diagram:
- The client,
- the server,
- the HTTP request,
- the HTTP response,
- and the data are all involved.
3. Design a REST API
Design a REST API on paper without actually programming. The API should include the following:
- At least 3 endpoints
- At least 3 HTTP methods
- At least 3 HTTP status codes
- At least 3 data types
4. JSON representation
Create a JSON representation of a your friend. The JSON should include the following:
- phone number
- email address