object template.update(object/array templates)
Este método permite actualizar las plantillas existentes.
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.
(object/array)
Template properties to be updated.
The templateid
property must be defined for each template, all other properties are optional. Only the given properties will be updated, all others will remain unchanged.
Additionally to the standard template properties, the method accepts the following parameters.
Parameter | Type | Description |
---|---|---|
groups | object/array | Host groups to replace the current host groups the templates belong to. The host groups must have the groupid property defined. |
tags | object/array | Template tags to replace the current template tags. |
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 | object/array | Templates to replace the currently linked templates. Templates that are not passed are only unlinked. The templates must have the templateid property defined. |
templates_clear | object/array | Templates to unlink and clear from the given templates. The templates must have the templateid property defined. |
(objeto)
Devuelve un objeto que contiene los ID de las plantillas actualizadas bajo la propiedad templateids
.
Cambie el nombre de la plantilla a "Plantilla OS Linux".
Solicitud:
{
"jsonrpc": "2.0",
"method": "template.update",
"params": {
"templateid": "10086",
"name": "Plantilla OS Linux"
},
"auth": "038e1d7b1735c6a5436ee9eae095879e",
"id": 1
}
Respuesta:
Replace all template tags with a new one.
Request:
{
"jsonrpc": "2.0",
"method": "template.update",
"params": {
"templateid": "10086",
"tags": [
{
"tag": "Host name",
"value": "{HOST.NAME}"
}
]
},
"auth": "038e1d7b1735c6a5436ee9eae095879e",
"id": 1
}
Response:
CTemplate::update() en ui/include/classes/api/services/CTemplate.php.