Difference between revisions of "REST API:Error Codes"

From LongJump Support Wiki
imported>Aeric
imported>Aeric
 
(3 intermediate revisions by the same user not shown)
Line 36: Line 36:
! Platform Code||with Http Status||Description
! Platform Code||with Http Status||Description
|-
|-
| align="center"| -1 || INTERNAL_SERVER_ERROR || Request could not be completed.<br/>See <tt>description</tt> for the error message.
| align="center"| -1 || INTERNAL_SERVER_ERROR (500) || Request could not be completed.<br/>See <tt>description</tt> for the error message.
|-
|-
| align="center"| -101 || UNAUTHORIZED || User was not logged in when the request was made.
| align="center"| -101 || UNAUTHORIZED || User not logged in
|-
|-
| align="center"| -200 || NOT_FOUND || Invalid object name, object ID, or record identifier
| align="center"| -200 || NOT_FOUND (404) || Invalid object name, object ID, or record identifier
|-
|-
| align="center"| -300 || BAD_REQUEST (400) || Resource does not exist
| align="center"| -300 || BAD_REQUEST (400) || Resource does not exist
Line 78: Line 78:
| align="center"| -4605 || BAD_REQUEST (400) || Invalid vote action
| align="center"| -4605 || BAD_REQUEST (400) || Invalid vote action


|-
| align="center"| -7000 || BAD_REQUEST (400) || Invalid index name
|}
|}


''Learn more:'' See the [{{DOCHOST}}/javadocs/constant-values.html javadoc constants] for a complete list of <tt>PlatformException</tt> error-code constants.
''Learn more:'' See the [{{DOCHOST}}/javadocs/constant-values.html javadoc constants] for a complete list of <tt>PlatformException</tt> error-code constants.
<noinclude>


{{#if: {{ShowDevInfo}} |
[[Category:REST API|error Codes]]
[[Category:REST API|error Codes]]
}}
</noinclude>

Latest revision as of 19:31, 6 June 2012

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.