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

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

[comment]: # ({84837b1b-84837b1b})
### Description

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

This method allows to create new proxies.

[comment]: # ({/84837b1b-84837b1b})

[comment]: # ({c2c1f195-c2c1f195})
### 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 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 to be created for the passive proxy.<br><br>Required for passive proxies.|

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

[comment]: # ({606a1465-606a1465})
### Return values

`(object)` Returns an object containing the IDs of the created proxies
under the `proxyids` property. The order of the returned IDs matches the
order of the passed proxies.

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

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

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

[comment]: # ({86fb9238-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]: # ({/86fb9238-86fb9238})

[comment]: # ({8e1098f9-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]: # ({/8e1098f9-8e1098f9})

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

-   [Host](/manual/api/reference/host/object#host)
-   [Proxy interface](object#proxy_interface)

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

[comment]: # ({eb5fb948-eb5fb948})
### Source

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

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