Error Handling

Applies to Collaborator 14.7, last modified on December 18, 2024

Responses form the JSON API web service contain a list of results corresponding to each of the command that was submitted. Each result may contain either a "result" : { } pair that lists the command return values (if any), or the "errors" : [ ] pair that lists the errors returned by the command.

If an error occurs during processing a request having multiple commands, the service stops execution of further commands and sends a response object with the results of preceding commands and the error description for the current command.

The Format of Error Descriptions

The returned "errors" : [ ] pair holds an array with one or more error descriptions. Each error description has the following fields:

  1. "code" - Short error code, which you can use for error handling.
  2. "message" - More detailed description of the error. This message can be displayed to the end-users.
  3. "data" - Any extra data that is relevant for the particular error. This is an optional field and it may be omitted.

Sample Error Descriptions

Below are several examples of error descriptions:

  • Unneeded parenthesis in command name:

    [ { "errors" : [

            { "code" : "NoSuchCommand",

            "message" : "The command 'ServerInfoService.getVersion()' does not exist." } ]

    } ]

  • Incorrect authentication:

    [ { "errors" : [

            { "code" : "AuthenticationFailed",

            "message" : "Could not authenticate user 'jsmith' using password provided." } ]

    } ]

See Also

JSON API Web Services

Highlight search results