Error handling for the REST API
This topic discusses the error codes you might encounter with the REST API.
Supported HTTP status codes
Code | Usage |
---|---|
201 | Successful update. Includes the Location header set to the URL of the new entry resource. |
204 | Successful update. |
Error codes
When responding to requests, the REST API uses some of the HTTP status codes. The following table gives a summary of the error codes that are returned.
Code | Name | Usage |
---|---|---|
400 | Bad Request | This code is used if the request body is not correct. For example, a JSON document is sent but it is not the correct format or the client sends a date value in the wrong format. |
401 | Unauthorized | This code is used if the user is not authenticated. |
403 | Forbidden | This code is used when the call is authenticated, but the user does not have access to the resource. For example, an entry operation on a form to which the user does not have permission. |
404 | Not found | This code is used when a resource does not exist. |
500 | Internal Server Error | This code is the default response for any error that occurs when an API call is being processed. |
JSON representation of an error
The HTTP status codes are the response that classify the failure of the request. The HTTP status code is provided in the response header, whereas, the additional information for the error is provided in the response body. The following code sample represents the format of the message you receive when you encounter an error:
{
"messageType": "ERROR",
"messageText": "Form does not exist on the server",
"messageAppendedText": "someFormName",
"messageNumber": 303
}
...
]
Name | Data type | Description |
---|---|---|
messageType | String | Type of message returned. For example, OK, ERROR, WARNING, FATAL, BAD STATUS. |
messageText | String | The actual text of the error message. |
messageAppendedText | String | The text that augments the error message. |
messageNumber | Integer | The error number associated with the error message. |