Hitachi

JP1 Version 12 JP1/Automatic Operation Command and API Reference 


2.5.7 Execution of a service

Function

Executes the specified service.

Execution permissions

Admin role, Develop role, Modify role, Submit role

API version

v1

Request format

POST http://host:port/Automation/version/objects/Services/id/actions/submit/invoke

The following shows the structure of the request body.

{
  "name" : "submit",
  "href" : "http://host:port/Automation/version/objects/Services/id/actions/submit/invoke",
  "method" : "POST",
  "parameters" : [ {...} ]
}

The following table describes the objects that can be specified as parameters (member) in the schema of a request.

Table 2‒51: Objects that can be specified as parameters (member)

Function

Resource name

Number

Description

Schedule

Schedule

1

Execution schedule of the service

List of property values

PropertyValue

0 to n

Input property for the service

The tables below describe properties that must be specified for these objects. The following members can be specified for properties regardless of when the service is executed (immediate, schedule, or recurrence).

Resource name

Member name

Number

Schedule

name

1

description

scheduleType

PropertyValue

keyName

0 to n

value

If the timing of service execution is Now or Recurring, the following members can be specified for the property.

Resource name

Member name

Number

Whether the property can be specified

Schedule

scheduledStartTime

1

Can be specified when Later is set.

recurrenceInterval

Can be specified when Recurring is set.

recurrenceMinutes

recurrenceDayOfWeek

recurrenceDayOfMonth

recurrenceLastDayOfMonth

recurrenceStartDate

recurrenceTime

Status code

The following table describes the various status codes that can be returned as the response to a request.

Status code

Message

Description

200

OK

Processing has been successfully completed.

400

Bad Request

The argument is invalid.

401

Unauthorized

The user does not have login permission.

403

Forbidden

The user does not have a permission for executing the service.

404

Not found

The user does not have a permission for acquiring the service, or the service does not exist.

412

Precondition failed

The server is not available.

500

Server-side error

A server processing error occurred.

Response schema

The following shows the structure of the response body for a request.

{
  "instanceId" : "instance-id",
  "created" : "created-date-and-time",
  "updated" : "updated-date-and-time",
  "completed" : "completed-date-and-time",
  "state" : "state",
  "affectedResources" : [ {...} ]
}

The following table describes the objects that can be output as affectedResources (member).

Table 2‒52: Objects that can be output as affectedResources (member) (Execution of a service)

Output

Resource name

Number

Description

Link to the created schedule

String

1

Link to the created resource for schedule functionality (Schedules)

Link to the created task

String

Link to the created resource for task functionality (Tasks)

Usage example

In the following example, the API function executes the service whose instanceID is 2015.

Request header:

POST /Automation/v1/objects/Services/2015/actions/submit/invoke HTTP/1.1
Host: 10.196.184.182:22015
Accept: application/json
Content-Type: application/json
Content-Length: 811
Authorization: Basic c3lzdGVtOm1hbmFnZXI=
User-Agent: useragent1
Accept-Language: ja

Response header:

HTTP/1.1 200 OK
Date: Mon, 14 Jul 2014 11:45:34 GMT
Server: Cosminexus HTTP Server
Access-Control-Expose-Headers: WWW-Authenticate
WWW-Authenticate: HSSO 72fe74c462e2a50793542df0c0589289ce3f3_Vlo8Y30JdDBUB3ljJSVPaRtjBSA=_V0810
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET, POST, DELETE, PUT, HEAD, OPTIONS
Access-Control-Allow-Credentials: true
Cache-Control: no-cache
Transfer-Encoding: chunked
Content-Type: application/json

Response body:

{
  "instanceID" : "3d9069ca-444f-4757-b0c5-a57ddd7d44cf",
  "created" : "2014-07-14T04:45:35.293-0700",
  "updated" : "2014-07-14T04:45:35.293-0700",
  "completed" : "2014-07-14T04:45:35.293-0700",
  "state" : "success",
  "affectedResource" : [ "http://10.196.184.182:22015/Automation/v1/objects/Schedules/2025", "http://10.196.184.182:22015/Automation/v1/objects/Tasks/2026" ]
}