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 no more than 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 "Remote command (cmd)" below.
-
For restapi
Refer to the "REST API (restapi)" table below.
-
For eventstatus
Refer to the tables in updating event status of events (eventstatus) below.
-
For jump
Refer to "When displaying/jumping (jump) the page of the specified URL" in the table below.
-
For remote command. (cmd)
Member name
Data type
Optional
Description
host
string
No
Specifies Execute destination Host name. Specify no more than 255 bytes. Otherwise, it is error.
cmd
string
No
Execute specifies OS command/parameter to be used. Specify no more than 4096 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 no more than 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 no more than 10 bytes. Otherwise, it is error.
url
string
No
Specifies URL of REST API to execute. Specify 2046 bytes or less. Otherwise, it is error.
headers
object
No
Specifies the header of REST API to execute. Specify no more than 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. When specifying, specify a value less than 10MB. Otherwise, it is error.
-
Updating event status of events (eventstatus)
Member name
Data type
Optional
Description
dealt
string
No
Specifies value of event status. Specify no more than 10 bytes. Otherwise, it is error.
eventSid
string
No
Specifies SID of JP1 events. Specify a value smaller 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 2046 bytes or less. Otherwise, it is error.
target
string
Yes
Specifies the target attribute. Specify 64 bytes or less. Otherwise, it is error.
-
- Status codes
-
The following shows the status codes that are returned in response. For details about message, see the manual 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
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 /im/api/v1/responseActions/eventsReplace HTTP/1.1 Authorization:Bearer anAxYWRtaW46TUdGa01tTTJNMlV3TURFNFh6STNYekE0T2pJME9qTXpYMTlmWDE5ZlgxOWZYMTlmWDE5ZlgycHdNV0ZrYldsdUlDQWdJQ0FnSUNBZ0lDQWdJQ0FnSUNBZ0lDQWdJQ0Fn Accept-Language: ja Content-Type: application/json Content-Length: 1024000 Accept: application/json { "actionType":"cmd", "params":{ "host":"${event:EVHOST}", "cmd":"\"C:\\Program Files (x86)\\Hitachi\\JP1IMM\\tools\\jim_log\" -f C:\\temp -q", "envFile":"C:\\tmp\\envFile.txt" } }- Response:
HTTP/1.1 200 OK Cache-Control: no-store, no-cache, max-age=0 Pragma: no-cache Expires: Thu, 01 Jan 1970 00:00:00 GMT Content-Type: application/json { "params":{ "host":"host001", "cmd":"\"C:\\Program Files (x86)\\Hitachi\\JP1IMM\\tools\\jim_log\" -f C:\\temp -q", "envFile":"C:\\tmp\\envFile.txt" }, "results":{ "host":0, "cmd":0, "envFile":0 } }