Status Codes

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 CodeMeaning
200OK - Everything worked as expected.
201The object was created.
202The request was accepted.
400Bad Request - The request was unacceptable.
401Unauthorized - An invalid API key was provided.
404Not Found - The requested resource does not exist.
422Validation - A parameter was not formatted correctly.
500Internal 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"
		}
	]
}