When an HTTP request is sent to a server, the server sends back an HTTP response message. The HTTP response message consists of an HTTP header and, optionally, a message body. The response header contains an HTTP status code that gives the status of the request.
When an API request fails, the API returns:
- An HTTP status code
- Conditionally, a system-specific error code
- A JSON-formatted error response body
The following table contains a list of HTTP status codes, their descriptions, and the types of HTTP requests that can generate each status code.
Status code | Meaning | Description | Methods |
---|---|---|---|
200 | OK | The request was executed successfully. |
PATCH POST |
400 | Bad Request | The request body contains one or more of these:
|
PATCH POST |
401 | Unauthorized | Your access is not authorized. Possible reasons:
|
PATCH POST |
403 | Forbidden | You do not have permission to perform the request. |
PATCH POST |
404 | Not Found | The resource you are trying to retrieve, edit, or delete cannot be found. |
PATCH POST |
405 | Method Not Allowed | A request was made using a request method not supported by that resource; for example, using GET with a form that needs data to be presented using POST. |
PATCH POST |
409 | Conflict | The resource you are trying to create already exists. |
POST |
500 | Internal Server Error | The system experienced an error. | |
501 | Unimplemented | An API was invoked that HCP for cloud scale doesn't support. |
PATCH POST |
503 | Service Unavailable | The service is not available. Possible reasons:
|
POST |
System-specific error codes
Some API requests return system-specific error codes in addition to an HTTP status code. These error codes are listed in the errorCodes field in the JSON response body. This table describes these error codes.
Status code | Description |
---|---|
4000 | SSL certificate not trusted. |
JSON response body
REST API error responses have this format:
{ "statusCode": <HTTP-status-code>, "errorCode": <system-specific-error-code>, "errorMessage": <message>, "errorProperties": [ { "name": <error-property>, "message": <error-property-message> } ] }