When a client sends a GET request to a REST API and the request is successful, what HTTP status code does the server typically return?
Think about the standard code that means 'OK' or success.
The HTTP status code 200 means the request was successful and the server is returning the requested data.
If a client sends a request with invalid data to a REST API, which HTTP status code should the server return to indicate a client error?
This code means 'Bad Request'.
HTTP 400 means the server cannot process the request because the client sent invalid data.
When a client requests a resource that does not exist on the server, which HTTP status code should the server return?
This code means the resource is missing.
HTTP 404 means the requested resource was not found on the server.
If the server fails due to an unexpected error, which HTTP status code should it return?
This code means 'Internal Server Error'.
HTTP 500 indicates the server has an error that prevents it from fulfilling the request.
Choose the best reason why REST APIs use standard HTTP status codes to communicate errors to machines.
Think about how machines read and react to responses.
Standard HTTP status codes provide a universal way for clients to know the result of their requests and handle errors automatically.