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":{"conversion-results-for-parameters-of-ResponseAction"} }■Parameters of ResponseAction
-
When action type is "Remote command (cmd)"
"params":{ "host":"execution-host-name", "cmd":"execution-command", "envFile":"environment-variable-file" }-
When action type is "REST API (restapi)"
"params":{ "method":"method-of-REST-API", "url":"URL-of-REST-API", "headers":"request-header-for-REST-API", "body":"request-body-of-REST-API" }-
When action type is "Updating event status of events (eventstatus)"
"params":{ "dealt":event-status, "eventSid":"SID-of-JP1-event,..." }-
When action type is "Displaying/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 of the request:
Member name
Data type
Optional
Description
eventSid
string
No
Specify the 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
Specify the 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
Specify the 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 For updating event status of events (eventstatus) table below.
-
For jump
See For displaying/jumping to the specified URL (jump) table below.
-
For remote command (cmd)
Member name
Data type
Optional
Description
host
string
No
Specify the execution host name. Specify a range of 1~255 bytes. Otherwise, it is error.
cmd
string
No
Specify the OS and parameters to be used. Specify a range of 1~4,096 bytes. Otherwise, it is error.
envFile
string
Yes
Specify the absolute path of the file on the execution host that 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
Specify the method of REST API to execute. Specify 7 bytes or less. Otherwise, it is error.
url
string
No
Specify the URL of REST API to execute. Specify a range of 1~2,046 bytes. Otherwise, it is error.
headers
object
No
Specify the header of REST API to execute. Specify a range of 1~65,536 bytes. Otherwise, it is error.
body
string
Yes
Specify 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.
-
For updating event status of events (eventstatus)
Member name
Data type
Optional
Description
dealt
int
No
Specify the value of event status. Specify with a range of 0~3. Otherwise, it is error.
eventSid
string
No
Specify the 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.
-
For displaying/jumping to the specified URL (jump)
Member name
Data type
Optional
Description
url
string
No
Specify the 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 } }