Hitachi

JP1 Version 13 JP1/Integrated Management 3 - Manager Command, Definition File and API Reference


5.16.3 Convert event-takeover info

Description

Converts event takeover information.

Execution permissions
  • JP1_Console_Admin

  • JP1_Console_Operator

API version

v1

Format
Request line
POST /application/component/apiVersion/responseActions/eventsReplace httpVersion
Request message body
{
  "eventSid":"SID of JP1 event",
  "actionType":"Action type",
  "params":{"Parameters of ResponseAction"}
}
Response message body
{
"params":{"Parameters of ResponseAction"},
"results":{"Convert ResponseAction parameters"}
}

■ResponseAction parameters

  • When action type" is set to "Remote command (cmd)"

    "params":{
        "host":"Execute host name",
        "cmd":"Command",
        "envFile":"Environment variable file"
    }
  • When action type" is "REST API(restapi)"

    "params":{
        "method":"REST API Methods",
        "url":"URL of REST API",
        "headers":"REST API request header",
        "body":"REST API request body"
    }
  • When action type" is "Updating event status of events (eventstatus)"

    "params":{
        "dealt":Event status,,
        "eventSid":"JP1 Events SID,..."
    }
  • When action type" is "Jumping to the specified URL (jump)"

    "params":{
        "url":"Destination URL",
        "target":"Target-attributes of HTML"
    }
Parameters

Here are the parameters that you specify for message body:

Member name

Data type

Optional

Description

eventSid

string

No

Specifies SID of JP1 events for which you want to retrieve detailed information. For details about JP1 event SID, see 7.2.1(1) Event information object. Specify a range of 1~512 bytes. Otherwise, it is error.

actionType

string

No

Specifies type" of ResponseAction.

One of the following value can be specified: If any other value is specified, error is returned.

  • cmd

    Execute remote command.

  • restapi

    Execute REST API

  • eventstatus

    Execute updating event status of an event.

  • jump

    Displays/jumps to the specified URL

params

object

No

Specifies ResponseAction content.

The parameters that you specify depend on type" of ResponseAction.

  • For cmd

    See For remote command (cmd) table below.

  • For restapi

    See For REST API (restapi) table below.

  • For eventstatus

    See Updating event status of events (eventstatus) table below.

  • For jump

    See When displaying/jumping (jump) the specified URL table below.

  • For remote command (cmd)

    Member name

    Data type

    Optional

    Description

    host

    string

    No

    Specifies Execute destination Host name. Specify a range of 1~255 bytes. Otherwise, it is error.

    cmd

    string

    No

    Execute specifies OS command/parameter to be used. Specify a range of 1~4,096 bytes. Otherwise, it is error.

    envFile

    string

    Yes

    Specifies the absolute file path of file at execute destination, which contains the environment variables to be read during command execution. Specify a range of 1~255 bytes. Otherwise, it is error.

  • For REST API (restapi)

    Member name

    Data type

    Optional

    Description

    method

    string

    No

    Specifies the method of REST API to execute. Specify 7 bytes or less. Otherwise, it is error.

    url

    string

    No

    Specifies URL of REST API to execute. Specify a range of 1~2,046 bytes. Otherwise, it is error.

    headers

    object

    No

    Specifies the header of REST API to execute. Specify a range of 1~65,536 bytes. Otherwise, it is error.

    body

    string

    Yes

    Specifies the body of REST API to execute. If you do not need a body, omit it. If specified, specify a range of less than 1~10MB. Otherwise, it is error.

  • Updating event status of events (eventstatus)

    Member name

    Data type

    Optional

    Description

    dealt

    int

    No

    Specifies value of event status. Specify with a range of 0~3. Otherwise, it is error.

    eventSid

    string

    No

    Specifies SID of JP1 events.

    To specify multiple event SIDs, consolidated the event SIDs with ",". You can specify up to 2000 records. Specify 1 or more, less than 1MB. Otherwise, it is error.

  • When displaying/jumping (jump) the specified URL

    Member name

    Data type

    Optional

    Description

    url

    string

    No

    Specify URL to jump to. Specify a range of 1~2,046 bytes. Otherwise, it is error.

    target

    string

    Yes

    Specifies the target attribute. Specify a range of 1~64 bytes. Otherwise, it is error.

Status codes

The following shows the status codes that are returned in response. For details about message, see the JP1/Integrated Management 3 - Manager Messages.

Status code

Message

Description

200

--

--

403

KAJY01000-E

You do not have execute permission for REST API.

400

KAJY63328-E

REST API parameter was specified incorrectly. The reason is that a parameter that cannot be omitted is omitted.

400

KAJY63329-E

JSON formatting of the request message body is invalid.

400

KAJY63330-E

The maximum number of bytes that can be specified was exceeded as a result of event inheritance information conversion processing.

500

KAJY63332-E

An error was returned in response from event detail info retrieval API.

500

KAJY63333-E

An unexpected error occurred in REST API processing.

500

KAJY00007-E

System error has occurred (out of disk, out of memory, etc.).

Return values

The following parameters are returned in response.

Member name

Data type

Description

params

object

Returns the parameters after event inheritance information conversion processing. Return in the same format as the parameterized "params". For details about parameter, see params in the parameter tables.

results

object

Returns the event takeover data conversion result corresponding to the above "params" parameters. Parameters that are omitted are not returned. Value returned by this parameter is as follows:

  • 0

    Normal termination.

  • 1

    Upper limit value was exceeded due to variable-transformation.

  • 2

    The attribute corresponding to the variable does not exist.

  • 3

    Attribute value of the corresponding property is an empty string.

  • 4

    The encoding specification format for the variable is invalid.

The response to error is in the format described in 5.2.6 Error response message when an error occurs, but "returnCode" is omitted. Extended information "extensions" assigns the same parameters as the response. However, if error processing occurs before event-takeover information conversion processing, omit this item.

■Extended info (extensions) parameters
{
  "timestamp":1539923958358,
  "status":400,
  ...Abbreviated...
  "extensions":{
    "params":{"Parameters of ResponseAction"},
    "results":{"Convert ResponseAction parameters"}
  }
}
Examples

The following shows how to execute a command.

Request:
POST http://hostname:20703/im/api/v1/responseActions/eventsReplace HTTP/1.1
content-type: application/json
... (omitted) ...
{
  "eventSid":"_JP1IM_HOST185/_JP1IMSEQNO_8/_JP1IMEVBSEQNO_401",
  "actionType":"cmd",
  "params":{
    "host":"${event:EVHOST:}",
    "cmd":"dir",
    "envFile":"C:\\tmp\\envFile.txt"
  }
}
Response:
HTTP/1.1 200 OK
content-type: application/json
...
{
  "params": {
    "host": "HOST185",
    "cmd": "dir",
    "envFile": "C:\\tmp\\envFile.txt"
  },
  "results": {
  "host": 0,
  "cmd": 0,
  "envFile": 0
  }
}