An HTTP 422: Unprocessable Entity error occurs when a request to the API can not be processed. This is a client-side error, meaning the problem is with the request itself, and not the API.
If you are receiving an HTTP 422: Unprocessable Entity error, there are several possibilities for why it might be occurring:
- You are sending in a payload that is not valid JSON
- You are sending HTTP headers, such as
Content-Type
orAccept
, which specify a value other thanapplication/json
- The request may be valid JSON, but there is something wrong with the content. For example, instructing the API to upgrade a cluster to a plan which does not exist.
Example
A call to the API that results in an HTTP 422: Unprocessable Entity error may look something like this:
{ "errors": [ "The Content-Type header specifies application/xml.", "The Accept header specifies a response format other than application/json.", "Your request could not be processed. " ], "status": 422 }
The "status": 422
key indicates the HTTP 422: Unprocessable Entity error.
Troubleshooting
The first step in troubleshooting this error is to carefully inspect the response from the API. It will often provide valuable information about what went wrong with the request. For example, if there was a problem creating a cluster because a plan slug was not recognized, you might see something like this:
{ "errors": [ "Plan 'sandboxing' not found.", "Please use the /plans endpoint for a list of available plans.", "Your request could not be processed. " ], "status": 422 }
If all else fails, you can always contact support and we will be glad to assist.