[comment]: # ({2ed6e81f-2ed6e81f})
# usermacro.update

[comment]: # ({/2ed6e81f-2ed6e81f})

[comment]: # ({0eae7762-23e3a148})
### Leírás

`object usermacro.update(object/array hostMacros)`

Ez a módszer lehetővé teszi a meglévő gazdagép makrók frissítését.

::: noteclassic
Ez a módszer csak az *Admin* és a *Kiemelt rendszergazda* számára érhető el
felhasználói típusok. A metódus meghívására vonatkozó engedélyek felhasználói szerepkörben visszavonhatók
beállítások. Lásd: [User
roles](/manual/web_interface/frontend_sections/administration/user_roles)
további információért.
:::

[comment]: # ({/0eae7762-23e3a148})

[comment]: # ({f8ce947c-f8ce947c})
### Paraméterek

`(objektum/tömb)` [Host makró tulajdonságai](object#host_macro) kell
frissítve.

A "hostmacroid" tulajdonságot minden gazdamakróhoz meg kell határozni
a többi tulajdonság nem kötelező. Csak az átadott tulajdonságok lesznek
frissítve, az összes többi változatlan marad.

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

[comment]: # ({5e19fc38-5e19fc38})
### Visszatérési értékek

`(object)` Egy objektumot ad vissza, amely tartalmazza a frissített gazdagép azonosítóit
makrók a "hostmacroids" tulajdonság alatt.

[comment]: # ({/5e19fc38-5e19fc38})

[comment]: # ({b41637d2-b41637d2})
### Példák

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

[comment]: # ({6d67f44d-bc8ce678})
#### Changing the value of a host macro

Change the value of a host macro to "public".

Request:

```json
{
    "jsonrpc": "2.0",
    "method": "usermacro.update",
    "params": {
        "hostmacroid": "1",
        "value": "public"
    },
    "auth": "038e1d7b1735c6a5436ee9eae095879e",
    "id": 1
}
```

Response:

```json
{
    "jsonrpc": "2.0",
    "result": {
        "hostmacroids": [
            "1"
        ]
    },
    "id": 1
}
```

[comment]: # ({/6d67f44d-bc8ce678})

[comment]: # ({new-129f453e})
#### Change macro value that was created by discovery rule

Convert discovery rule created "automatic" macro to "manual" and change its value to "new-value".

[Request](/manual/api#performing-requests):

```json
{
    "jsonrpc": "2.0",
    "method": "usermacro.update",
    "params": {
        "hostmacroid": "1",
        "value": "new-value",
        "automatic": "0"
    },
    "id": 1
}
```

Response:

```json
{
    "jsonrpc": "2.0",
    "result": {
        "hostmacroids": [
            "1"
        ]
    },
    "id": 1
}
```

[comment]: # ({/new-129f453e})

[comment]: # ({2eddd7d2-2eddd7d2})
### Forrás

CUserMacro::update() in
*ui/include/classes/api/services/CUserMacro.php*.

[comment]: # ({/2eddd7d2-2eddd7d2})
