[comment]: # translation:outdated

[comment]: # ({04928fa3-04928fa3})
# discoveryrule.copy

[comment]: # ({/04928fa3-04928fa3})

[comment]: # ({new-8ae93b5b})
### Description

`object discoveryrule.copy(object parameters)`

This method allows to copy LLD rules with all of the prototypes to the
given hosts.

::: noteclassic
This method is only available to *Admin* and *Super admin*
user types. Permissions to call the method can be revoked in user role
settings. See [User
roles](/manual/web_interface/frontend_sections/administration/user_roles)
for more information.
:::

[comment]: # ({/new-8ae93b5b})

[comment]: # ({new-47295f20})
### Parameters

`(object)` Parameters defining the LLD rules to copy and the target
hosts.

|Parameter|[Type](/manual/api/reference_commentary#data_types)|Description|
|---------|---------------------------------------------------|-----------|
|discoveryids|array|IDs of the LLD rules to be copied.|
|hostids|array|IDs of the hosts to copy the LLD rules to.|

[comment]: # ({/new-47295f20})

[comment]: # ({b8760eee-b8760eee})
### Valori restituiti

`(boolean)` Restituisce `true` se la copia ha avuto successo.

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

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

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

[comment]: # ({new-91be874e})
#### Copy an LLD rule to multiple hosts

Copy an LLD rule to two hosts.

Request:

``` {.java}
{
    "jsonrpc": "2.0",
    "method": "discoveryrule.copy",
    "params": {
        "discoveryids": [
            "27426"
        ],
        "hostids": [
            "10196",
            "10197"
        ]
    },
    "auth": "038e1d7b1735c6a5436ee9eae095879e",
    "id": 1
}
```

Response:

``` {.java}
{
    "jsonrpc": "2.0",
    "result": true,
    "id": 1
}
```

[comment]: # ({/new-91be874e})

[comment]: # ({8870f994-8870f994})
### Fonte

CDicoveryrule::copy() in
*ui/include/classes/api/services/CDiscoveryRule.php*.

[comment]: # ({/8870f994-8870f994})
