Hitachi

JP1 Version 12 JP1/Automatic Operation Command and API Reference 


2.4.11 Creation of a service based on a service template

Function

Creates a service based on the specified service template. You can specify property values when creating a service.

Execution permissions

Admin role, Develop role, Modify role

API version

v1

Request format

POST http://host:port/Automation/version/objects/ServiceTemplates/id/actions/bind/invoke

The following shows the structure of the request body.

 { 
"name" : "bind", 
"href" : "http://host:port/Automation/version/objects/ServiceTemplates/id/actions/bind/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‒47: Objects that can be specified as parameters (member)

Function

Resource name

Number

Description

Service

Services

1

Service to be created

Property value

PropertyValues

0

Input property for the service

The following describes the properties that must be specified for the above objects.

Resource name

Member name

Number

Services

name

1

description

tags

supportedScheduleType

serviceState

serviceGroupName

PropertyValues

value

0 to n

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

Failed due to one of the following reasons:

  • The argument is invalid.

  • Permissions allocated to the service group are invalid.

  • The specified service name already exists.

  • The number of services or tags has reached the maximum.

401

Unauthorized

The user does not have login permission.

403

Forbidden

The user does not have permission to create services.

404

Not found

The user does not have permission to acquire service templates, or the service template 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.

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

Usage example

In the following example, the API function creates a service based on the service template whose instanceID is 560.

Request header:

POST /Automation/v1/objects/ServiceTemplates/560/actions/bind/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: 1001
Accept-Language: ja

Response header:

HTTP/1.1 200 OK
Date: Thu, 30 Jul 2015 02:30:37 GMT
Server: Cosminexus HTTP Server
Access-Control-Expose-Headers: WWW-Authenticate
WWW-Authenticate: HSSO fdef80b1cbd2d625cdbda39c16fda15f68a3d8c_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" : "55e8c5b7-b0ab-4016-ba62-f334b67c20c4",
  "created" : "2015-07-30T11:30:39.042+09:00",
  "updated" : "2015-07-30T11:30:39.042+09:00",
  "completed" : "2015-07-30T11:30:39.042+09:00",
  "state" : "success",
  "affectedResource" : [ "http://10.196.184.182:22015/Automation/v1/objects/Services/2004" ],
  "result" : [ ]
}