2.4.6 Import of a service template
Function
Imports the specified service template.
Execution permissions
Admin role, Develop role
API version
v1
Request format
POST http://host:port/Automation/version/services/ServiceTemplates/actions/import/invoke
In the request body, specify a service template (.st or .zip).
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 specified file is not a .st or .zip file. Alternatively, the specified .st or .zip file is corrupted or invalid. |
401 |
Unauthorized |
The user does not have login permission. |
403 |
Forbidden |
The user does not have import permission. |
412 |
Precondition failed |
The server is not available. |
415 |
Unsupported media type |
The specified Content-Type header is invalid. |
500 |
Server-side error |
An attempt to store the temporary folder failed, or 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 imports a service template (SP_GenericApplication_01.20.00.st).
Request header: POST /Automation/v1/services/ServiceTemplates/actions/import/invoke HTTP/1.1 Authorization: Basic c3lzdGVtOm1hbmFnZXI= User-Agent: curl/7.36.0 Host: 10.196.184.182:22015 Accept: application/json Content-Length: 2106265 Expect: 100-continue Content-Type: multipart/form-data; boundary=------------------------5564f06622f7727e Accept-Language: ja Response header: HTTP/1.1 100 Continue HTTP/1.1 200 OK Date: Wed, 29 Jul 2015 07:48:21 GMT Server: Cosminexus HTTP Server Access-Control-Expose-Headers: WWW-Authenticate WWW-Authenticate: HSSO 9c9f012d1d34b9ede86d68728604c884b85e8_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" : "f4c5065a-ff42-45df-bca9-e2d79b4b5bb7", "created" : "2015-07-29T16:48:26.528+09:00", "updated" : "2015-07-29T16:48:26.528+09:00", "completed" : "2015-07-29T16:48:26.528+09:00", "state" : "success", "affectedResource" : [ "http://10.196.184.182:22015/Automation/v1/objects/ServiceTemplates/1116" ], "result" : [ { "message" : "The service template was imported successfully (service template file name: SP_GenericApplication_01.20.00.st).", "messageID" : "KNAE03111-I" } ] }