[comment]: # ({e42e8a0a-e42e8a0a})
# veidne.massupdate

[comment]: # ({/e42e8a0a-e42e8a0a})

[comment]: # ({07d18cd5-cf27d8f8})
### Apraksts

`object template.massupdate(object parameters)`

Šī metode ļauj vienlaikus aizstāt vai noņemt saistītos objektus
un atjaunināt īpašības vairākām veidnēm.

::: noteclassic
Šī metode ir pieejama tikai *Admin* un *Super admin*
lietotāju tipiem. Tiesības izsaukt šo metodi var atsaukt lietotāja lomas
iestatījumos. Plašāku informāciju skatiet sadaļā [Lietotāju
lomas](/manual/web_interface/frontend_sections/users/user_roles).
:::

[comment]: # ({/07d18cd5-cf27d8f8})

[comment]: # ({36905fa8-1f7d5759})
### Parametri

`(object)` Parametri, kas satur to veidņu ID, kuras jāatjaunina, un objektus, ar kuriem veidnes jāaizstāj.

Metode pieņem šādus parametrus.

|Parameter|[Type](/manual/api/reference_commentary#data-types)|Description|
|--|--|------|
|templates|object/array|[Veidnes](/manual/api/reference/template/object), kas jāatjaunina.<br><br>Veidnēm jābūt definētam tikai `templateid` atribūtam.<br><br>[Parametra darbība](/manual/api/reference_commentary#parameter-behavior):<br>- *required*|
|groups|object/array|[Veidņu grupas](/manual/api/reference/templategroup/object), ar kurām aizstāt pašreizējās veidņu grupas, kurām veidnes pieder.<br><br>Veidņu grupām jābūt definētam tikai `groupid` atribūtam.|
|macros|object/array|[Lietotāja makro](/manual/api/reference/usermacro/object), ar kuriem aizstāt visas pašreizējās lietotāja makro norādītajās veidnēs.|
|templates\_clear|object/array|[Veidnes](/manual/api/reference/template/object), kuras jāatsaista un jānotīra no norādītajām veidnēm.<br><br>Veidnēm jābūt definētam tikai `templateid` atribūtam.|
|templates\_link|object/array|[Veidnes](/manual/api/reference/template/object), ar kurām jāaizstāj pašlaik saistītās veidnes.<br><br>Veidnēm jābūt definētam tikai `templateid` atribūtam.|

[comment]: # ({/36905fa8-1f7d5759})

[comment]: # ({dcba01c8-dcba01c8})
### Atgrieztās vērtības

`(object)` Atgriež objektu, kas satur atjaunināto veidņu ID zem `templateids` īpašības.

[comment]: # ({/dcba01c8-dcba01c8})

[comment]: # ({b41637d2-b41637d2})
### Piemēri

[comment]: # ({/b41637d2-b41637d2})

[comment]: # ({089f8542-d18b091c})
#### Veidnes atsaistīšana

Atsaistīt un notīrīt veidni "10091" no norādītajām veidnēm.

[Pieprasījums](/manual/api#performing-requests):

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

Atbilde:

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

[comment]: # ({/089f8542-d18b091c})

[comment]: # ({eec18141-0ecefb75})
#### Lietotāja makro aizstāšana

Aizstājiet visus lietotāja makro ar norādīto lietotāja makro vairākās veidnēs.

[Pieprasījums](/manual/api#performing-requests):

```json
{
    "jsonrpc": "2.0",
    "method": "template.massupdate",
    "params": {
        "templates": [
            {
                "templateid": "10074"
            },
            {
                "templateid": "10075"
            },
            {
                "templateid": "10076"
            },
            {
                "templateid": "10077"
            }
        ],
        "macros": [
            {
                "macro": "{$AGENT.TIMEOUT}",
                "value": "5m",
                "description": "Timeout after which agent is considered unavailable. Works only for agents reachable from Zabbix server/proxy (passive mode)."
            }
        ]
    },
    "id": 1
}
```

Atbilde:

```json
{
    "jsonrpc": "2.0",
    "result": {
        "templateids": [
            "10074",
            "10075",
            "10076",
            "10077"
        ]
    },
    "id": 1
}
```

[comment]: # ({/eec18141-0ecefb75})

[comment]: # ({6b25b639-5d283e35})
### Skatīt arī

-   [template.update](update)
-   [template.massadd](massadd)
-   [Veidņu grupa](/manual/api/reference/templategroup/object#template-group)
-   [Lietotāja makro](/manual/api/reference/usermacro/object#hosttemplate-level-macro)

[comment]: # ({/6b25b639-5d283e35})

[comment]: # ({b5f8dcd9-b5f8dcd9})
### Avots

CTemplate::massUpdate() iekš
*ui/include/classes/api/services/CTemplate.php*.

[comment]: # ({/b5f8dcd9-b5f8dcd9})
