This is a translation of the original English documentation page. Help us make it better.

service.update

説明

object service.update(object/array services)

このメソッドで、既存のサービスを更新できます。

このメソッドはどのタイプのユーザーでも利用可能です。このメソッドを呼び出す権限は、ユーザーロール設定で取り消すことができます。詳しくはユーザーの役割を参照してください。

Parameters

(object/array) service properties to be updated.

The serviceid property must be defined for each service, all other properties are optional. Only the passed properties will be updated, all others will remain unchanged.

Additionally to the standard service properties, the method accepts the following parameters.

Parameter Type Description
children array Child services to replace the current child services.

The child services must have only the serviceid property defined.
parents array Parent services to replace the current parent services.

The parent services must have only the serviceid property defined.
tags array Service tags to replace the current service tags.
problem_tags array Problem tags to replace the current problem tags.
status_rules array Status rules to replace the current status rules.

戻り値

(object) serviceidsプロパティの下で更新されたサービスのIDを含むオブジェクトを返します。

親サービスを設定する

ID"3"のサービスをID"5"のサービスの親にします。

Request:

{
           "jsonrpc": "2.0",
           "method": "service.update",
           "params": {
               "serviceid": "5",
               "parents": [
                   {
                       "serviceid": "3"
                   }
               ]
           },
           "auth": "038e1d7b1735c6a5436ee9eae095879e",
           "id": 1
       }

Response:

{
           "jsonrpc": "2.0",
           "result": {
               "serviceids": [
                   "5"
               ]
           },
           "id": 1
       }

スケジュールされたダウンタイムの追加

ID"4"のサービスに毎週月曜日22:00から火曜日10:00でスケジュールされたダウンタイムを追加します

Request:

{
           "jsonrpc": "2.0",
           "method": "service.update",
           "params": {
               "serviceid": "4",
               "times": [
                   {
                       "type": "1",
                       "ts_from": "165600",
                       "ts_to": "201600"
                   }
               ]
           },
           "auth": "038e1d7b1735c6a5436ee9eae095879e",
           "id": 1
       }

Response:

{
           "jsonrpc": "2.0",
           "result": {
               "serviceids": [
                   "4"
               ]
           },
           "id": 1
       }

ソース

CService::update() in ui/include/classes/api/services/CService.php.

OSZAR »