0
0
Rest APIprogramming~5 mins

Example requests and responses in Rest API - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is a REST API request?
A REST API request is a message sent by a client to a server to ask for data or to perform an action, usually using HTTP methods like GET, POST, PUT, or DELETE.
Click to reveal answer
beginner
What does a typical REST API response contain?
A typical REST API response contains a status code (like 200 for success), headers, and a body with data usually formatted in JSON.
Click to reveal answer
beginner
Example of a GET request to fetch user data
GET /users/123 HTTP/1.1 Host: api.example.com Accept: application/json
Click to reveal answer
beginner
Example of a JSON response for a user fetch request
{ "id": 123, "name": "Alice", "email": "alice@example.com" }
Click to reveal answer
beginner
What HTTP status code means 'Resource not found'?
The HTTP status code 404 means 'Resource not found'. It tells the client that the requested data does not exist on the server.
Click to reveal answer
Which HTTP method is used to retrieve data from a REST API?
AGET
BPOST
CPUT
DDELETE
What does a 200 HTTP status code indicate?
AClient error
BSuccess
CResource not found
DServer error
Which content type is most commonly used in REST API responses?
Aapplication/xml
Btext/html
Cimage/png
Dapplication/json
What HTTP method is used to create a new resource?
APOST
BGET
CPUT
DDELETE
What does a 404 status code mean in a REST API response?
ASuccess
BUnauthorized
CResource not found
DServer error
Explain the structure of a typical REST API request and response.
Think about what the client sends and what the server replies.
You got /7 concepts.
    Describe how you would use a REST API to get user information and handle the response.
    Imagine you want to see a friend's profile on a website.
    You got /6 concepts.