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

template.massupdate

Descripción

object template.massupdate(object parameters)

Este método permite reemplazar o eliminar simultáneamente objetos relacionados. y actualizar propiedades en múltiples plantillas.

Este método solo está disponible para los tipos de usuario Administrador y Superadministrador. Los permisos para llamar al método se pueden revocar en la configuración del rol de usuario. Ver Roles de usuario para obtener más información.

Parameters

(object) Parameters containing the IDs of the templates to update and the properties that should be updated.

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

Parameter Type Description
templates
(required)
object/array Templates to be updated.

The templates must have the templateid property defined.
groups object/array Host groups to replace the current host groups the templates belong to.

The host groups must have the groupid property defined.
hosts object/array Hosts and templates to replace the ones the templates are currently linked to.

Both hosts and templates must use the hostid property to pass an ID.
macros object/array User macros to replace the current user macros on the given templates.
templates_clear object/array Templates to unlink and clear from the given templates.

The templates must have the templateid property defined.
templates_link object/array Templates to replace the currently linked templates.

The templates must have the templateid property defined.

Valores de retorno

(objeto) Devuelve un objeto que contiene los ID de las plantillas actualizadas bajo la propiedad templateids.

Ejemplos

Reemplazo de grupos de equipos

Desvincule y borre la plantilla "10091" de las plantillas proporcionadas.

Solicitud:

{
           "jsonrpc": "2.0",
           "method": "template.massupdate",
           "params": {
               "templates": [
                   {
                       "templateid": "10085"
                   },
                   {
                       "templateid": "10086"
                   }
               ],
               "templates_clear": [
                   {
                       "templateid": "10091"
                   }
               ]
           },
           "auth": "038e1d7b1735c6a5436ee9eae095879e",
           "id": 1
       }

Respuesta:

{
           "jsonrpc": "2.0",
           "result": {
               "templateids": [
                   "10085",
                   "10086"
               ]
           },
           "id": 1
       }

Ver también

Fuente

CTemplate::massUpdate() en ui/include/classes/api/services/CTemplate.php.