Hitachi

JP1 Version 12 JP1/Automatic Job Management System 3 Command Reference


6.5.2 Response format when an error occurs in an API

The following describes individual elements of the response when an error occurs in an API.

Organization of this subsection

(1) Details of the response

The following describes the values returned as the response.

Protocol version

The fixed value HTTP/1.1 is returned.

Status code

A status code that indicates the processing result is returned. For details, see the description for each API.

Text description of the status code

A text description of the status code that indicates the processing result is returned. For details, see the description for each API.

Response header

The following table lists and describes the response headers.

Table 6‒11: List of response headers

Response Header

Description

Cache-Control

These response headers control the cache of the response information.

Pragma

Expires

Content-Type

Response data format.

The fixed value application/json is returned.

Message body

Error information is returned in JSON format. UTF-8 is used for the character encoding. The following shows details of the error information.

Format of the error information:
{
  "errorSource":"URI-where-an-error-occurred"
  "message":"message-body",
  "messageID":"message-ID",
  "application":"application-information",
  "extensions": [
    additional-information-of-the-error,...
  ]
}
Members of the error information:

Member name

Data type

Description

errorSource

string

The URI where an error occurred is returned.

message

string

The message body is returned.

messageID

string

The message ID is returned.

application

string

The application information is returned. The fixed value ajs is returned.

extensions

object

The additional information of the error is returned in array format.

Format of the additional information of the error:
{
  "key":"key-name-of-the-additional-information",
  "value":value-for-the-key-for-the-additional-information,
}
Members of the additional error information:

Member name

Data type

Description

key

string

The key name of the additional information is returned.

value

string

The value corresponding to the key for the additional information is returned.

(2) Example response

The following shows an example response when the query string (mandatory) is not specified:

HTTP/1.1 400 Bad Request
Content-Type: application/json
Cache-Control: no-store, no-cache, max-age=0
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Pragma: no-cache
 
{
  "errorSource": "http://HostA:22252/ajs/api/v1/objects/statuses",
  "message": "Specify the scheduler service name.",
  "messageID": "KNAK3201-E",
  "application": "ajs",
  "extensions": [
    {
      "key": "error_type",
      "value": "PARAMETER"
    },
    {
      "key": "error_code",
      "value": "ERROR_PARAM_EMPTY"
    },
    {
      "key": "error_parameter",
      "value": "serviceName"
    }
  ]
}