0
0
Rest APIprogramming~5 mins

200 OK and 201 Created in Rest API - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What does the HTTP status code 200 OK mean?
It means the request was successful, and the server has returned the requested data or completed the action.
Click to reveal answer
beginner
When should a server respond with 201 Created?
When a new resource has been successfully created as a result of the client's request, the server responds with 201 Created.
Click to reveal answer
intermediate
What is a common difference between 200 OK and 201 Created responses?
200 OK means the request succeeded generally, while 201 Created specifically means a new resource was made.
Click to reveal answer
intermediate
In REST APIs, what should the server include in the response when sending 201 Created?
The server should include a Location header with the URL of the newly created resource.
Click to reveal answer
beginner
True or False: A 200 OK response can be used for both GET and POST requests.
True. 200 OK is a general success status and can be used for many request types, including GET and POST.
Click to reveal answer
Which HTTP status code indicates a resource was successfully created?
A201 Created
B200 OK
C404 Not Found
D500 Internal Server Error
What does a 200 OK status code usually mean?
AServer error
BResource created
CClient error
DRequest succeeded
When responding with 201 Created, what should the server include?
AEmpty body
BLocation header with new resource URL
CError message
DRedirect URL
Can 200 OK be used for a successful POST request?
AYes
BNo
COnly for GET requests
DOnly for DELETE requests
Which status code is NOT appropriate for a successful resource creation?
A201 Created
B200 OK
C404 Not Found
DNone of the above
Explain the difference between 200 OK and 201 Created in REST APIs.
Think about when you create something new versus just getting data.
You got /3 concepts.
    Describe when and why a server should use the 201 Created status code.
    Focus on resource creation and client notification.
    You got /3 concepts.