2.5.3 Editing a service
Function
Edits the specified service.
You cannot use this API function to change the property values of services. If you want to change property values, see the topic 2.9.6 Batch update of property values or 2.9.8 Update of a property value.
Users who have the Submit role can update only the favorite property. Users who have the Admin, Develop, or Modify role can update all properties.
Execution permissions
Admin role, Develop role, Modify role, Submit role
API version
v1
Request format
PUT http://host:port/Automation/version/objects/Services/id
The request schema has the same format as the response body for the API function Acquisition of service information. The following table describes the object that can be specified as Services (member).
Function |
Resource name |
Number |
Description |
---|---|---|---|
Service |
Services |
1 |
Services resource that has the specified ID |
The following table describes the properties that must be specified for this object.
Resource name |
Member name |
Number |
---|---|---|
Services |
name |
1 |
description |
||
tags |
||
favorite |
||
serviceState |
||
supportedScheduleType |
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, or the specified service name already exists. |
401 |
Unauthorized |
The user does not have login permission. |
404 |
Not found |
The user does not have permission to acquire services, 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, "name" : "service-display-name", "description" : "description-text", "tags" : "tags" "serviceTemplateName" : "service-template-name" "createTime" : "created-date-and-time", "modifyTime" : "updated-date-and-time", "serviceState" : "service-state" "serviceGroupName" : "service-group-name", "iconURL" : "icon-URL", "vendorName" : "vendor-name", "version" : "version" "lastSubmitTime" : "last-submit-time", "favorite" : {true|false}, "failedCount" : failed-count, "completedCount" : completed-count, "executedCount" : executed-count, "latest" : {true|false}, "imageURL" : "image-URL", "supportedScheduleType" : "supported-schedule-type", "submitCount" : submit-count, "serviceTemplateID" : service-template-id, "serviceGroupID" : service-group-id, "supportedActionType" : supported-action-type }
Usage example
In the following example, the API function edits the service whose instanceID is 2015.
Request header: PUT /Automation/v1/objects/Services/2015 HTTP/1.1 Host: 10.196.184.238:22015 Accept: application/json Authorization: Basic c3lzdGVtOm1hbmFnZXI= User-Agent: useragent1 Accept-Language: ja Response header: HTTP/1.1 200 OK Date: Mon, 14 Jul 2014 11:40:10 GMT Server: Cosminexus HTTP Server Access-Control-Expose-Headers: WWW-Authenticate WWW-Authenticate: HSSO 5929972368348e976584903133f5f8ce93ce2aec_Vlo8Y30JBWoKHUYTEXAMXx5iHgQ=_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" : 2015, "name" : "testService1", "description" : "description", "tags" : "", "serviceTemplateName" : "testService", "createTime" : "2014-07-14T01:16:11.000-0700", "modifyTime" : "2014-07-14T04:36:30.000-0700", "serviceState" : "release", "serviceGroupName" : "DefaultServiceGroup", "iconURL" : "http://10.196.184.238:22015/Automation/icon/services/com.hitachi.software/remoteCommandExe/01.20.00", "vendorName" : "Hitachi,Ltd.", "version" : "01.20.00", "lastSubmitTime" : "2014-07-14T01:16:11.000-0700", "favorite" : false, "failedCount" : 0, "completedCount" : 0, "executedCount" : 0, "latest" : true, "supportedScheduleType" : "immediate,schedule,recurrence", "submitCount" : 0, "serviceTemplateID" : 5106, "serviceGroupID" : 3, "supportedActionType" : "forciblyStop,retry" }