object template.massadd(object parameters)
Este método permite agregar simultáneamente múltiples objetos relacionados a las plantillas dadas.
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)
Parameters containing the IDs of the templates to update and the objects to add to the templates.
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 add the given templates to. The host groups must have the groupid property defined. |
hosts | object/array | Hosts and templates to link the given templates to. The hosts must have the hostid property defined. |
macros | object/array | User macros to be created for the given templates. |
templates_link | object/array | Templates to link to 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
.
Agregue el grupo de equipos "2" a dos plantillas.
Solicitud:
{
"jsonrpc": "2.0",
"method": "template.massadd",
"params": {
"templates": [
{
"templateid": "10085"
},
{
"templateid": "10086"
}
],
"groups": [
{
"groupid": "2"
}
]
},
"auth": "038e1d7b1735c6a5436ee9eae095879e",
"id": 1
}
Respuesta:
Vincula las plantillas "10106" y "10104" a la plantilla.
Solicitud:
{
"jsonrpc": "2.0",
"method": "template.massadd",
"params": {
"templates": [
{
"templateid": "10073"
}
],
"templates_link": [
{
"templateid": "10106"
},
{
"templateid": "10104"
}
]
},
"auth": "038e1d7b1735c6a5436ee9eae095879e",
"id": 1
}
Respuesta:
CTemplate::massAdd() en ui/include/classes/api/services/CTemplate.php.