[comment]: # translation:outdated

[comment]: # ({2a0a5084-2a0a5084})
# host.massremove

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

[comment]: # ({c46733ea-9c943195})
### Descrizione

`object host.massremove(object parameters)`

Questo metodo consente di rimuovere oggetti correlati da più host.

::: noteclassic
Questo metodo è disponibile solo per i tipi di utente *Admin* e *Super admin*.
Le autorizzazioni per chiamare il metodo possono essere revocate nelle impostazioni del ruolo utente.
Per ulteriori informazioni, vedere [Ruoli utente](/manual/web_interface/frontend_sections/users/user_roles).
:::

[comment]: # ({/c46733ea-9c943195})

[comment]: # ({7774cf37-689d39a3})
### Parametri

`(object)` Parametri contenenti gli ID degli host da aggiornare e gli
oggetti che devono essere rimossi.

|Parametro|[Type](/manual/api/reference_commentary#data-types)|Descrizione|
|--|--|------|
|hostids|ID/array|ID degli host da aggiornare.<br><br>[Comportamento del parametro](/manual/api/reference_commentary#parameter-behavior):<br>- *obbligatorio*|
|groupids|ID/array|ID dei [gruppi di host](/manual/api/reference/hostgroup/object) da cui rimuovere gli host specificati.|
|interfaces|object/array|[Interfacce host](/manual/api/reference/hostinterface/object) da rimuovere dagli host specificati.<br><br>L'oggetto interfaccia host deve avere definite solo le proprietà `ip`, `dns` e `port`.|
|macros|string/array|[Macro utente](/manual/api/reference/usermacro/object) da eliminare dagli host specificati.|
|templateids|ID/array|ID dei [template](/manual/api/reference/template/object) da scollegare dagli host specificati.|
|templateids\_clear|ID/array|ID dei [template](/manual/api/reference/template/object) da scollegare e rimuovere dagli host specificati.|

[comment]: # ({/7774cf37-689d39a3})

[comment]: # ({d166b99b-d166b99b})
### Valori di ritorno

`(object)` Restituisce un oggetto contenente gli ID degli host aggiornati
sotto la proprietà `hostids`.

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

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

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

[comment]: # ({e1df8faa-8c635a7b})
#### Scollegamento dei template

Scollega un template da due host ed elimina tutte le entità
templateizzate.

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

```json
{
    "jsonrpc": "2.0",
    "method": "host.massremove",
    "params": {
        "hostids": ["69665", "69666"],
        "templateids_clear": "325"
    },
    "id": 1
}
```

Risposta:

```json
{
    "jsonrpc": "2.0",
    "result": {
        "hostids": [
            "69665",
            "69666"
        ]
    },
    "id": 1
}
```

[comment]: # ({/e1df8faa-8c635a7b})

[comment]: # ({48715467-abd9a8d3})
### Vedi anche

-   [host.update](update)
-   [Macro
    utente](/manual/api/reference/usermacro/object#hosttemplate-level-macro)
-   [Interfaccia
    host](/manual/api/reference/hostinterface/object#host-interface)

[comment]: # ({/48715467-abd9a8d3})

[comment]: # ({bda21fe6-bda21fe6})
### Fonte

CHost::massRemove() in *ui/include/classes/api/services/CHost.php*.

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