Error Handling
Along with data, the Claromentis REST APIs returns the usual HTTP status codes detailed in rfc-2616. This includes error codes when something doesn't go exactly to plan. Often, requests that result in an error code will also return an error message to let you know what went wrong.
As an illustrative example, here are some common HTTP status codes and their meanings.
Code | Meaning |
---|---|
200 OK | Request successful, data is returned |
201 Created | Returned in response to a request that creates a new object |
204 No Content | Request successful, but there no data to return (E.G a DELETE request) |
400 Bad Request | The server doesn't understand the request. For example, when a request should contain an object id but doesn't contain one |
401 Unauthorised | Access requires authentication, but credentials/access token are not provided or invalid |
403 Forbidden | access denied or no rights to perform requested action. Only received by authenticated users who try to do something they don’t have permissions for. |
404 Not Found | Resource not found. Can be returned for example when a client tries to get information about non-existent user |
422 Unprocessable Entity | The supplied data has failed validation |
500 Internal Server Error | An error meant the request could not be completed. Response body usually contains a more detailed error message about exactly what went wrong |
501 Not Implemented | This is sent when a client tries to send REST request with an invalid application name, function name or resource type |