Errors

(Difference between revisions)
Jump to: navigation, search
(HTTP Status Codes)
Line 3: Line 3:
 
The status codes and JSON structure are described below. However, some APIs may differ slightly. In such case, refer to the specific API documentation for further information.
 
The status codes and JSON structure are described below. However, some APIs may differ slightly. In such case, refer to the specific API documentation for further information.
  
== HTTP Status Codes ==
+
= HTTP Status Codes =
  
 
The following table contains the main codes and their simple descriptions. See specific API documentations for more detailed information.
 
The following table contains the main codes and their simple descriptions. See specific API documentations for more detailed information.
Line 44: Line 44:
 
| An unknown error happened.
 
| An unknown error happened.
 
|}
 
|}
 +
 +
= JSON Structure =
 +
 +
The response JSON is formatted as a hash in the format field:value, the following fields are returned:
 +
 +
{|
 +
! align="left" width="200px"  | error
 +
| width="200px" | required
 +
| Error code. One of: authentication_failed, bad_request, conflict, forbidden, internal_server_error, invalid_parameters, missing_parameters, not_acceptable, not_found, unauthorized, unprocessable_entity.
 +
|-
 +
! align="left" width="200px"  | error_description
 +
| width="200px" | required
 +
| Human readable error message.
 +
|-
 +
! align="left" width="200px"  | errors
 +
| width="200px" | optional
 +
| Array with error descriptions. Each array element is either a string with an error message or a hash in the format field:value with the following fields:
 +
|-
 +
! align="left" width="200px" style="padding-left: 20px" | attribute
 +
| width="200px" | required
 +
| Name of the attribute with error. If the error has no associated attribute, its value is set to "base".
 +
|-
 +
! align="left" width="200px" style="padding-left: 20px" | message
 +
| width="200px" | required
 +
| Human readable error message.
 +
|-
 +
! align="left" width="200px" style="padding-left: 20px" | code
 +
| width="200px" | required
 +
| Error code. See the table below for detailed information.
 +
|-
 +
! align="left" width="200px" style="padding-left: 20px" | value
 +
| width="200px" | optional
 +
| Auxiliary field to inform which value the error refers to.
 +
|-
 +
! align="left" width="200px" style="padding-left: 20px" | count
 +
| width="200px" | optional
 +
| Auxiliary field to inform which count the error refers to.
 +
|}
 +
 +
== JSON Error codes ==

Revision as of 17:07, 5 May 2015

In the case of errors in the request, an error code will be set properly. The response status will be set to the respective HTTP status code and the body may contain a JSON value with more information concerning the error.

The status codes and JSON structure are described below. However, some APIs may differ slightly. In such case, refer to the specific API documentation for further information.

HTTP Status Codes

The following table contains the main codes and their simple descriptions. See specific API documentations for more detailed information.

Code Status Description
400 bad_request Some required parameter was not informed.
401 unauthorized The authentication is wrong. See Authentication.
403 forbidden The request wan not accepted due to semantic permission errors.
404 not_found Some resource was not found.
406 not_acceptable The requested format is not accepted. Make sure the "Content-Type" header is set correctly.
409 conflict A semantic conflict happened.
422 unprocessable_entity A validation error occurred.
500 internal_server_error An unknown error happened.

JSON Structure

The response JSON is formatted as a hash in the format field:value, the following fields are returned:

error required Error code. One of: authentication_failed, bad_request, conflict, forbidden, internal_server_error, invalid_parameters, missing_parameters, not_acceptable, not_found, unauthorized, unprocessable_entity.
error_description required Human readable error message.
errors optional Array with error descriptions. Each array element is either a string with an error message or a hash in the format field:value with the following fields:
attribute required Name of the attribute with error. If the error has no associated attribute, its value is set to "base".
message required Human readable error message.
code required Error code. See the table below for detailed information.
value optional Auxiliary field to inform which value the error refers to.
count optional Auxiliary field to inform which count the error refers to.

JSON Error codes

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox