Esta es una traducción de la página de documentación original en español. Ayúdanos a mejorarla.

service.update

Descripción

object service.update(object/array services)

Este método permite actualizar los servicios existentes.

Este método está disponible para usuarios de cualquier tipo. Los permisos para llamar al método se pueden revocar en la configuración de roles de usuario. Ver Roles de usuario para obtener más información.

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

(objeto) Devuelve un objeto que contiene los ID de los servicios actualizados bajo la propiedad serviceids.

Ejemplos

Configuración del servicio principal para un servicio

Haga que el servicio con ID "3" sea el servicio principal del servicio con ID "5".

Solicitud:

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

Respuesta:

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

Agregar un tiempo de inactividad programado

Agregue un tiempo de inactividad para el servicio con ID "4" programado semanalmente a partir del lunes 22:00 hasta el martes 10:00.

Solicitud:

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

Respuesta:

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

Fuente

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