service.update
Descrição
object service.update(object/array services)
Este método permite atualizar os serviços existentes.
Este método está disponível para usuários de qualquer tipo. As permissões para chamar o método podem ser revogadas nas configurações de função do usuário. Consulte Funções de usuário para obter mais informações.
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 service children. The children must have the serviceid property defined. |
| parents | array | Parent services to replace the current service parents. The parents must have the serviceid property defined. |
| tags | array | Service tags to replace the current service tags. |
| times | array | Service times to replace the current service times. |
| problem_tags | array | Problem tags to replace the current problem tags. |
| status_rules | array | Status rules to replace the current status rules. |
Valores de retorno
(object) Retorna um objeto contendo os IDs dos serviços atualizados na propriedade serviceids.
Exemplos
Configurando um serviço pai para um serviço
Faça o serviço com ID "3" ser o pai do serviço com 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
}
Adicionando um tempo de inatividade programado
Adicione um tempo de inatividade para serviço com ID "4" agendado semanalmente de segunda-feira às 22:00 até terça-feira às 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
}
Fonte
CService::update() in ui/include/classes/api/services/CService.php.