Status Codes
How you know whether your request succeeded.
What are status codes?
When you make an API request, our response will include an HTTP status code. These are standard responses web services may give to their clients' requests to indicate success or failure.
Let's say you made a request to create a new note:
curl --request POST \
--url https://restapi.rev.io/v1/Notes \
--data '{"customer_id":1001,"body":"This is a test note."}'
And got this response:
HTTP/1.1 201 Created
Content-Type: application/json
Location: http://restapi.rev.io/v1/Notes/1013
Server: Microsoft-IIS/8.5
X-Powered-By: ASP.NET
Date: Thu, 22 Feb 2018 20:55:57 GMT
Connection: close
Content-Length: 228
X-Frame-Options: SAMEORIGIN
{
"ok": true,
"id": 11027
}
The first line, "HTTP/1.1 201 Created", contains the status code: 201. This code indicates your request was successful, and your note was created. (You can see the details of the new note in the body of the response.)
We've listed the different types of codes we return below.
Success
200-level status codes (codes from 200 to 299) indicate your request was successfully received, understood, and processed.
Status Code | Message | Explanation |
---|---|---|
200 | OK | Result of a successful request. |
201 | Created | Result of a successful request to create a new resource. |
Client error
400-level status codes usually indicate you or your API client made an error.
Status Code | Message | Explanation |
---|---|---|
400 | Bad Request | The request was unacceptable, often due to missing a required parameter. |
401 | Unauthorized | You are not authenticated or authentication failed. |
403 | Forbidden | You don't have permission to perform an action or access a resource. |
404 | Not Found | You requested a resource that doesn't exist. |
405 | Method Not Allowed | You used an HTTP method we don't allow. (For example, you POSTed to /reports/1234/result, and POST is not supported for this resource.) |
Server error
500-level status codes usually indicate we made an error or can't fulfill your request.
Status Code | Message | Explanation |
---|---|---|
500 | Server Error | An error occurred on our side. |
501 | Not Implemented | You used an HTTP method we currently don't allow, but we will allow it in the future. (For example, you POSTed to /payments, and we haven't implemented POST for that resource yet.) |
503 | Service Unavailable | We currently can't handle your request. We may be performing maintenance, or we might have received too many requests to process at once. |
504 | Gateway Timeout | A gateway or proxy server didn't get a response quickly enough. This probably means one of our systems or our Internet service provider (ISP)'s systems is having issues. There could also be a problem with your proxy or ISP. |
Updated over 3 years ago
Status codes sometimes tell you everything you need to know, but we often provide more detailed content in the body of our responses.