Hitachi

JP1 Version 12 JP1/Automatic Operation Command and API Reference 


2.5.18 Change of the version of the service template used by a service

Function

Applies the service template of any version to the specified service.

Execution permissions

Admin role, Develop role, Modify role

API version

v1

Request format

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

The following shows the structure of the request body.

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

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

Table 2‒53: Object that can be specified as parameters (member)

Function

Resource name

Number

Description

Service template

ServiceTemplate

1

Service template to be upgraded

The following table describes the property that must be specified for this object.

Resource name

Member name

Number

ServiceTemplate

instanceID

1

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

 

401

Unauthorized

The user does not have login permission.

404

Not found

The permission is invalid, or the resource does not exist.

409

Conflict

The status of the target service template is invalid.

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" : [ {...} ],
  "result" : [ {...} ],
  "resultType" : "result-type"
}

Usage example

In the following example, the API function changes the version of the service template used by the service whose instanceID is 2188.

Request header:

POST /Automation/v1/objects/Services/2188/actions/applyTemplate/invoke HTTP/1.1
Authorization: Basic c3lzdGVtOm1hbmFnZXI=
User-Agent: curl/7.36.0
Host: 10.196.184.182:22015
Accept: application/json
Content-Type: application/json
Content-Length: 1199
Expect: 100-continue
Accept-Language: ja

Response header:

HTTP/1.1 100 Continue
HTTP/1.1 200 OK
Date: Thu, 30 Jul 2015 05:23:38 GMT
Server: Cosminexus HTTP Server
Access-Control-Expose-Headers: WWW-Authenticate
WWW-Authenticate: HSSO 456eb72dda7029ba9cbdf3dd57233a25247d2717_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" : "10920fed-ad4f-4be1-9015-bd2066e5312c",
  "created" : "2015-07-30T14:23:38.683+09:00",
  "updated" : "2015-07-30T14:23:38.683+09:00",
  "completed" : "2015-07-30T14:23:38.683+09:00",
  "state" : "success",
  "affectedResource" : [ "http://10.196.184.182:22015/Automation/v1/objects/Services/2188" ],
  "result" : [ ]
}