Apex REST API

HTTP Status

The success or failure of each HTTP request is shown in the status field of the HTTP response header, which contains standard HTTP status codes:

  • a 2xx code for success
  • a 4xx or 5xx code for failure
The header of the response looks something like this:
HTTP/1.1 200 OK
Date: Mon, 01 Apr 2013 01:39:16 GMT
Content-Length: 24768
Content-Type: application/json;charset=utf-8
Connection: close
Server: Apache-Coyote/1.1

The response body, in JSON format, immediately follows the header.
		


Http Status Codes

Status Code Error Message Description
200 OK The request has succeeded and there is content to be returned.
201 Created The request has been fulfilled and resulted in a new resource being created. The newly created resource can be referenced by the URI(s) returned in the entity of the response, with the most specific URI for the resource given by a Location header field.
202 Accepted The request has been accepted for processing, but the processing has not been completed. The request might or might not eventually be acted upon, as it might be disallowed when processing actually takes place.
204 No Content The server has fulfilled the request but it has no content to be returned.
207 Multi-Status This response conveys information about multiple resources in situations where multiple status codes might be appropriate.
400 Bad Request The request could not be fulfilled because of data error. The client should NOT repeat the request without modifications.
401 Unauthorized The token is invalid.
403 Forbidden The server understood the request, but is refusing to fulfill it because the client does not have the access to manage the resource.
404 Not Found The server has not found anything matching the Request-URI.
405 Method Not Allowed The method specified in the Request-Line is not allowed for the resource identified by the Request-URI.
409 Conflict The request could not be completed due to a conflict with the current state of the resource.
500 Internal Server Error The server encountered an unexpected condition which prevented it from fulfilling the request.

Application Error Codes

Sometimes things go wrong, and in that case you might see a response like:

  {
    "code": missing_input,
    "message": "..."
  }

The following table lists the error code that could be in the response body:

Error Code Http Status Code Description
missing_input 400, Bad Request {0} is missing or empty
missing_object 400, Bad Request {0} is missing
invalid_input 400, Bad Request Invalid {0}: "{1}"
invalid_length 400, Bad Request {0}: "{1}" violates length requirements
date_in_past 400, Bad Request {0}: "{1}" cannot be in the past
date_in_future 400, Bad Request {0}: "{1}" cannot be in the future
invalid_date_range 400, Bad Request {0}: "{1}" should be earlier than {2}: "{3}"
invalid_region_country 400, Bad Request Invalid region or country: "{0}-{1}"
not_found 400, Bad Request {0} is not found: "{1}"
invalid_json_format 400, Bad Request Invalid JSON format: "{0}"
duplicate_input 400, Bad Request {0}: "{1}" already exists
no_birth_certificate 400, Bad Request No Birth Certificate found for PoU "{0}"
already_registered 400, Bad Request PoU "{0}" is already registered
decommissioning_in_progress 400, Bad Request Decommissioning is in progress for PoU "{0}"
cannot_decommission 400, Bad Request PoU "{0}" has open orders
already_associated 400, Bad Request {0}: "{1}" is already associated with another {2}
missing_request_body 400, Bad Request RequestBody is missing or empty
exceed_max_page_size 400, Bad Request Exceeds max page size
no_pou_address 400, Bad Request Client should have at least one address of type POUPLACEMENT
position_status_error 400, Bad Request Status cannot be changed to {0} for {1}:"{2}"
missing_parent_preference 400, Bad Request Parent preference "{0}" is missing or empty
missing_preference 400, Bad Request Preference "{0}" is missing or empty
missing_preference_value 400, Bad Request Preference value "{0}" is missing or empty
missing_preference_defined_value 400, Bad Request Preference value {0}:"{1}" is not found for entity type {2}
preference_not_applicable 207, Multi-Status Preference "{0}" is not applicable to entity "{1}"
preference_not_available 400, Bad Request Preference "{0}" is not available on entity type "{1}"
invalid_request 400, Bad Request The request was rejected because the URL was not normalized
cannot_release 400, Bad Request "{0}":"{1}" cannot be released as it is not in the correct state for release
invalid_status 400, Bad Request "{0}":"{1}" cannot be locked down as it is not in the correct state for lockdown
lockdown_prohibited 400, Bad Request "{0}":"{1}" cannot be locked down as it is not in the correct state for lockdown
cannot_cancel 400, Bad Request "{0}":"{1}" cannot be cancelled as it is not in the correct status
cannot_update 400, Bad Request "{0}":"{1}" cannot be updated as it is not in the correct status
not_available 400, Bad Request "{0}": "{1}" is not available for use
invalid_model 400, Bad Request No Model found for "{0}":"{1}"
session_not_available 400, Bad Request Session is not available for PoU with serial number: "{0}"
kiosk_not_supported 400, Bad Request Kiosk is not supported for {0}:"{1}"
invalid_body 400, Bad Request {0} and {1} cannot be passed together in the same request
cannot_dissociate 400, Bad Request {0}: "{1}" cannot be dissociated at this time : {2}
missing_customization 400, Bad Request Element customization is missing or empty
invalid_content 400, Bad Request Content does not match supplied content type
invalid_size 400, Bad Request {0}: "{1}" violates size requirements
exceed_array_size 400, Bad Request Exceeds max {0} size
inactive_status 400, Bad Request {0}: "{1}" is inactive
duplicate_request 400, Bad Request Request for {0}: {1} already exists
cannot_change 400, Bad Request Default value cannot be set to false for {0}:"{1}"
combination_not_found 400, Bad Request {0}: "{1}", {2}: "{3}" and {4}: "{5}" combination is not found
status_update_error 400, Bad Request Delivery status for {0}:{1} was not successfully updated to {2}
no_association_two_entities 400, Bad Request There is no association between {0}: "{1}" and {2}: "{3}"
not_registered 400, Bad Request {0}: "{1}" is not registered
not_online 400, Bad Request {0}: "{1}" is not online