[comment]: # translation:outdated

[comment]: # ({07099686-07099686})
# proxy.create

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

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

`object proxy.create(object/array proxies)`

This method allows to create new proxies.

::: noteclassic
This method is only available to *Super admin* user type.
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-e0abed38})

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

`(object/array)` Proxies to create.

Additionally to the [standard proxy properties](object#proxy), the
method accepts the following parameters.

|Parameter|[Type](/manual/api/reference_commentary#data_types)|Description|
|---------|---------------------------------------------------|-----------|
|hosts|array|[Hosts](/manual/api/reference/host/object) to be monitored by the proxy. If a host is already monitored by a different proxy, it will be reassigned to the current proxy.<br><br>The hosts must have the `hostid` property defined.|
|interface|object|Host [interface](/manual/api/reference/hostinterface/object) to be created for the passive proxy.<br><br>Required for passive proxies.|

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

[comment]: # ({41544960-606a1465})
### Restituisce i valori

"(object)" Restituisce un oggetto contenente gli ID dei proxy creati nella proprietà "proxyids". L'ordine del
gli ID restituiti corrispondono all'ordine dei proxy passati.

[comment]: # ({/41544960-606a1465})

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

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

[comment]: # ({new-86fb9238})
#### Create an active proxy

Create an action proxy "Active proxy" and assign a host to be monitored
by it.

Request:

``` {.java}
{
    "jsonrpc": "2.0",
    "method": "proxy.create",
    "params": {
        "host": "Active proxy",
        "status": "5",
        "hosts": [
            {
                "hostid": "10279"
            }
        ]
    },
    "auth": "ab9638041ec6922cb14b07982b268f47",
    "id": 1
}
```

Response:

``` {.java}
{
    "jsonrpc": "2.0",
    "result": {
        "proxyids": [
            "10280"
        ]
    },
    "id": 1
}
```

[comment]: # ({/new-86fb9238})

[comment]: # ({new-8e1098f9})
#### Create a passive proxy

Create a passive proxy "Passive proxy" and assign two hosts to be
monitored by it.

Request:

``` {.java}
{
    "jsonrpc": "2.0",
    "method": "proxy.create",
    "params": {
        "host": "Passive proxy",
        "status": "6",
        "interface": {
            "ip": "127.0.0.1",
            "dns": "",
            "useip": "1",
            "port": "10051"
        },
        "hosts": [
            {
                "hostid": "10192"
            },
            {
                "hostid": "10139"
            }
        ]
    },
    "auth": "ab9638041ec6922cb14b07982b268f47",
    "id": 1
}
```

Response:

``` {.java}
{
    "jsonrpc": "2.0",
    "result": {
        "proxyids": [
            "10284"
        ]
    },
    "id": 1
}
```

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

[comment]: # ({273e0fd8-273e0fd8})
### Guarda anche

- [Host](/manual/api/reference/host/object#host)
- [Interfaccia proxy](object#proxy_interface)

[comment]: # ({/273e0fd8-273e0fd8})

[comment]: # ({453e4545-453e4545})
### Fonte

CProxy::create() in *ui/include/classes/api/services/CProxy.php*.

[comment]: # ({/453e4545-453e4545})
