You can invoke commands that the execute action function can run.
Execution permission
Admin, Modify
Request line
POST baseURL/v1/services/CustomAction/actions/invokeCommandAction/invoke
Request body
The structure of the request body and the object attributes are as follows:Action
{
"name":"...",
"href":"...",
"method":"...",
"type":"...",
"parameters":["...", ...]
}
Action (Type: Action)
|
Attribute |
Type |
Description |
|---|---|---|
|
name |
string |
Name of the action. |
|
href |
string |
URL for the action. |
|
method |
string |
Name of the method. |
|
type |
string |
Data format for the object. |
|
parameters |
anyType[] |
A list of InvokeCommandActionParam objects necessary to execute an operation. For details, see the table below. |
InvokeCommandActionParam
{
"componentID":"...",
"nodeID":"...",
"templateFileName":"...",
"commandParameter":"..."
}
InvokeCommandActionParam (Type: InvokeCommandActionParam)
|
Attribute |
Type |
Description |
|---|---|---|
|
componentID |
string |
ID of the component specified as the action execution target. The ID of the device that the component belongs to must also be specified. To execute an action for a device, omit this parameter. |
|
nodeID |
string |
ID of the device specified as the action execution target |
|
templateFileName |
string |
Name of the template file in which the action is registered |
|
commandParameter |
string |
Parameter for the command to be executed. Set a string encoded in Base64. |
Response body
The structure of the response body and the object attributes is as follows:Job
{
"instanceID":"...",
"created":"...",
"updated":"...",
"completed":"...",
"state":"...",
"affectedResource":["...", ...],
"result":["...", ...]
}
Job (Type: Job)
|
Attribute |
Type |
Description |
|---|---|---|
|
instanceID |
string |
ID of the Instance. |
|
created |
string |
Date the object is generated in "yyyy-mm-ddThh:mm:ss.mmmTZD" format (e.g., 2017-08-25T20:07:39.472+09:00). |
|
updated |
string |
Time the object is updated in "yyyy-mm-ddThh:mm:ss.mmmTZD" format (e.g., 2017-08-25T20:07:39.472+09:00). |
|
completed |
string |
Time the processing completed in "yyyy-mm-ddThh:mm:ss.mmmTZD" format (e.g., 2017-08-25T20:07:39.472+09:00). |
|
state |
string |
One of the following values is set: "failed": The operation failed. "success": The operation completed successfully. |
|
affectedResource |
string[] |
A blank space is set. |
|
result |
anyType[] |
A list of objects. No value is set. |
Status codes
|
Status code |
Reason phrase |
Description |
|---|---|---|
|
200 |
OK |
Success. |
|
400 |
Bad Request |
The format of the request body is invalid. |
|
401 |
Unauthorized |
No login privilege. |
|
403 |
Forbidden |
No update privilege. |
|
404 |
Not Found |
The resource was not found. |
|
412 |
Precondition Failed |
The server is not available. |
|
500 |
Internal Server Error |
Server processing error. |
|
503 |
Service Unavailable |
Analyzer detail view server communication error. |
Example code
[Request Header]
POST /Analytics/v1/services/CustomAction/actions/invokeCommandAction/invoke
Authorization: Basic c3lzdGVtOm1hbmFnZXI=
Host: localhost:22015
Accept: application/json
Content-Type: application/json
[Request Body]
{
"name": "invokeCommandAction",
"href": "http://localhost:22015/Analytics/v1/services/CustomAction/actions/invokeCommandAction/invoke",
"method": "POST",
"type": "application/json",
"parameters":[{
"nodeID":"h#ITPDLab_172.17.17.115_host-258",
"templateFileName":"/opt/hitachi/Analytics/conf/template/command/CmdTemplate.txt",
"commandParameter":""
}]
}
[Response Header]
HTTP/1.1 200 OK
Date: Thu, 11 Aug 2016 17:56:33 GMT
Server: Cosminexus HTTP Server
Cache-Control: no-cache
WWW-Authenticate: HSSO 8113b75377dac59b7c48ee2b947b20d3bbc11f_YXZvNFIMehp3UB4jbmVyPGUgT3Q=_V0810
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff
Transfer-Encoding: chunked
Content-Type: application/json
[Response Body]
{
"instanceID" : "b3fe1e36-1737-426c-bdd2-c5706472e2bc",
"created" : "2016-08-12T02:56:33.366+09:00",
"updated" : "2016-08-12T02:56:33.409+09:00",
"completed" : "2016-08-12T02:56:33.409+09:00",
"state" : "success",
"affectedResource" : [ ],
"result" : [ ]
}