REST API:Error Codes

From LongJump Support Wiki
Revision as of 22:40, 16 February 2012 by imported>Aeric (→‎Platform Message Codes)

All requests return standard HTTP status codes as well as a message code and description, in the body of the response.

HTTP Status Codes

The most commonly returned HTTP status codes are:

Code Status Description
200 SUCCESS Returned by a successful GET, PUT, or DELETE.
201 CREATE_SUCCEEDED Returned by a successful POST. Indicates that a new entity has been added to the platform.
400 BAD_REQUEST Invalid argument, or other error as indicated by accompanying platform message.
404 BAD_URL The specified resource does not exist, or the server could not be reached.
405 METHOD_NOT_ALLOWED The requested resource does not respond to the specified method, or to the content type of the request. This message is returned when:
  • The wrong method type was specified. (Typically, GET instead of POST, or vice versa.)
  • The wrong URL was specified. (The URL exists, but it's not one that responds to the specified method.)
  • The wrong content-type was specified. (The URL exists, and the method is valid, but there is no variant of the resource that processes the specified content type.)

(Check your spelling, and double-check the API description.)

415 UNSUPPORTED_MEDIA_TYPE Content-Type has not been specified in the request header. Depending on data format, it should either be application/xml or application/json.
Learn more: Response Status

Platform Message Codes

In addition to the standard HTTP return code, the body of the response from the server includes a <message> section, which contains:

code
An Integer containing a success or failure code:
  • A value of 0 indicates a successful call
  • Any negative value (<0) indicates an error
description
A String containing an explanatory message.

The most commonly returned platform message codes are:

Platform Code with Http Status Description
-1 INTERNAL_SERVER_ERROR (500) Request could not be completed.
See description for the error message.
-101 UNAUTHORIZED User not logged in
-200 NOT_FOUND (404) Invalid object name, object ID, or record identifier
-300 BAD_REQUEST (400) Resource does not exist
-400 BAD_REQUEST (400) Invalid time zone
-690 BAD_REQUEST (400) Record does not exist
-850 BAD_REQUEST (400) Insufficient permission for this operation
-4000 BAD_REQUEST (400) Error downloading package
-4001 BAD_REQUEST (400) Please provide file name
-4003 BAD_REQUEST (400) Manage Packages permission is not enabled
-4004 BAD_REQUEST (400) Provide either file name or Package ID
-4005 BAD_REQUEST (400) Invalid package ID
-4006 BAD_REQUEST (400) Invalid Tenant ID
-4007 BAD_REQUEST (400) Invalid deploy time
-4600 FORBIDDEN (403) Relay is not enabled for this tenant
-4601 BAD_REQUEST (400) Invalid payload for a Relay resource (data is not well formed, has an invalid tag, or is missing a required tag)
-4602 BAD_REQUEST (400) Invalid Relay type
-4603 BAD_REQUEST (400) Invalid ID
-4604 BAD_REQUEST (400) Duplicate follower
-4605 BAD_REQUEST (400) Invalid vote action
-7000 BAD_REQUEST (400) Invalid index name

Learn more: See the javadoc constants for a complete list of PlatformException error-code constants.