HTTP Response Status Codes

When you’re working with web services and the APIs of companies whose data you would like to use, it is important to understand the method these services use to communicate with you—HTTP response status codes.

When issuing requests to these services, you may receive any number of responses back in different address ranges. These codes will help you determine whether there were any major issues, if there was something expected by the service that was not present in the request, or if everything was sent and processed successfully.

In the response structure that a service sends back, you should be able to extract the HTTP response, which generally comprises the response code and a description that explains it.

There is a vast number of possible response codes, but the address ranges that will be returned will allow you to pinpoint any issues or decide whether you can process the response as a success case. These ranges include:

1xx range

The request has been received and processing is in progress.

2xx range

The request has been received, understood, accepted, and processed successfully.

3xx range

The request has been received, but the client needs to take additional actions to complete the request.

4xx range

There was an error in the request sent by the client. The response from the server should indicate the specific issue encountered.

5xx range

The request was received and appears to be valid, but an error occurred while the server was attempting to process it.

Understanding ...

Get Programming Social Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.