Middesk uses standard HTTP response codes to indicate the success or failure of an API request.
As a rule of thumb, Codes in the 2xx range indicate success. Codes in the 4xx range indicate an error in the provided information (e.g., a required parameter was omitted, a validation error has occurred, etc.). Codes in the 5xx range indicate an error with Middesk servers.
Some 4xx errors will include a brief explanation of the error in the response body.
Status Code | Meaning |
---|---|
200 | OK - Everything worked as expected. |
201 | The object was created. |
202 | The request was accepted. |
400 | Bad Request - The request was unacceptable. |
401 | Unauthorized - An invalid API key was provided. |
404 | Not Found - The requested resource does not exist. |
422 | Validation - A parameter was not formatted correctly. |
500 | Internal Server Error - We had a problem with our server. |
Error Messages
When Middesk encounters an error processing a request, Middesk returns 4xx or 5xx status code and a JSON response containing information about the error encountered. The errors array will contain 1 or more Error
objects. each Error object will contain a message
field explaining the error processing a requests; some Error
objects will contain an optional parameter
field highlighting what field caused the error.
{
"errors": [
{
"message": "Parameter `name` is missing",
"parameter": "name"
},
{
"message": "Person email required for `emailrisk` module"
}
]
}