1Overview
The device's network settings are not a single endpoint; instead, they are configured item by item through a generic option read/write endpoint, and are then applied by the device to the eth0 interface. The basic configuration flow is as follows:
- First log in to obtain a token (
token) — see the Login API guide. - Set each network option as needed: for a static IP, first configure the IP / mask / gateway / DNS.
- Finally, set
net_mode(0 = static, 1 = DHCP) to trigger the apply. - Once the device applies the settings, it operates with the new configuration; after switching the IP, reconnect using the new address.
2Connection Information
| Protocol | Default Port | Base URL |
|---|---|---|
| HTTP | 80 | http://<camera-ip>/ |
| HTTPS | 443 | https://<camera-ip>/ |
The content type for both requests and responses is application/json. All network settings endpoints must carry the token:
Authorization: Bearer <access_token>
The device's factory-default network setting is DHCP, with a fallback static address of 192.168.1.168 / 255.255.255.0.
3Network Options Overview
The options below fall into two categories: string type (configured with /set_string) and integer type (configured with /set_option).
| Option Key | Type | Description | Example / Default |
|---|---|---|---|
net_mode | integer | Network mode: 0 = static IP, 1 = DHCP | 1 (DHCP) |
net_ipv4 | string | Static IPv4 address | 192.168.1.168 |
net_mask | string | Subnet mask | 255.255.255.0 |
net_gateway | string | Default gateway | 192.168.1.254 |
net_dns | string | DNS server | 168.95.1.1 |
0/1; do not send them as strings. String options (such as net_ipv4) must be set with /set_string, and must never be mixed with the integer endpoint.4Configuration Endpoints
All of the following endpoints are POST and require a token.
Sets a string-type network option (such as net_ipv4, net_mask, net_gateway, net_dns).
Request Parameters
| Field | Type | Required | Description |
|---|---|---|---|
method | string | Yes | Fixed value "SetString" |
option | string | Yes | Option key, such as net_ipv4 |
value | string | Yes | Option value, such as 192.168.1.100 |
Request
POST /set_string
Authorization: Bearer <access_token>
Content-Type: application/json
{
"method": "SetString",
"option": "net_ipv4",
"value": "192.168.1.100"
}
Response · 200 OK
{ "code": 200, "msg": "ok", "data": null }
Sets an integer-type network option (such as net_mode).
Request Parameters
| Field | Type | Required | Description |
|---|---|---|---|
method | string | Yes | Fixed value "Set" |
option | string | Yes | Option key, such as net_mode |
value | int | Yes | Option value (integer), such as 0 or 1 |
Request
POST /set_option
Authorization: Bearer <access_token>
Content-Type: application/json
{
"method": "Set",
"option": "net_mode",
"value": 1
}
Response · 200 OK
{ "code": 200, "msg": "ok", "data": null }
net_mode is the action that actually triggers the network apply, so in static mode be sure to set it last.Reads the current value of a single option. Use method: "Get" for integer options; use method: "GetString" for string options.
Request Parameters
| Field | Type | Required | Description |
|---|---|---|---|
method | string | Yes | "Get" (integer) or "GetString" (string) |
option | string | Yes | Option key |
Request · Read String (IP)
POST /get_option
Authorization: Bearer <access_token>
Content-Type: application/json
{ "method": "GetString", "option": "net_ipv4" }
Response · 200 OK
{ "code": 200, "msg": "ok", "data": "192.168.1.100" }
Request · Read Integer (Mode)
{ "method": "Get", "option": "net_mode" }
Response · 200 OK
{ "code": 200, "msg": "ok", "data": 1 }
Adds a secondary IP on eth0 (virtual interface eth0:1, with a fixed /24 mask), for use when a second network segment must be attached at the same time. This is an interface provided for compatibility with existing tools and does not affect the primary eth0 configuration.
Request
GET /cgi-bin?SubNetwork=192.168.2.50
/24 and is not persisted; it must be reconfigured after the device reboots.5Flow Example · Switch to DHCP
DHCP mode only requires setting net_mode = 1:
curl -X POST https://<camera-ip>/set_option \
-H "Authorization: Bearer <access_token>" \
-H "Content-Type: application/json" \
-d '{"method":"Set","option":"net_mode","value":1}'
The device will use udhcpc to obtain an address from the DHCP server.
6Flow Example · Configure a Static IP
Be sure to set all address parameters first, and set net_mode = 0 last to trigger the apply.
Step 1 · Set IP / Mask / Gateway / DNS
curl -X POST https://<camera-ip>/set_string -H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{"method":"SetString","option":"net_ipv4","value":"192.168.1.100"}'
curl -X POST https://<camera-ip>/set_string -H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{"method":"SetString","option":"net_mask","value":"255.255.255.0"}'
curl -X POST https://<camera-ip>/set_string -H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{"method":"SetString","option":"net_gateway","value":"192.168.1.254"}'
curl -X POST https://<camera-ip>/set_string -H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{"method":"SetString","option":"net_dns","value":"168.95.1.1"}'
Step 2 · Switch to Static Mode (Trigger Apply)
curl -X POST https://<camera-ip>/set_option -H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{"method":"Set","option":"net_mode","value":0}'
Step 3 · Reconnect Using the New Address and Verify
curl -X POST https://192.168.1.100/get_option -H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{"method":"GetString","option":"net_ipv4"}'
7Responses and Error Codes
All responses use a unified JSON structure:
{ "code": <http_status>, "msg": "<message>", "data": <payload> }
| HTTP | Message | Meaning |
|---|---|---|
200 | ok | Success. data is the read value or null |
400 | invalid params | Malformed request, a required field is missing, or the option is a restricted option |
401 | token malformed / failed | Token is missing, malformed, or not accepted |
401 | token password error | Token is invalid (usually because the password has changed); log in again |
500 | — | Device-side configuration failed or is not yet ready |
8Notes
- Configuration order: In static mode, be sure to finish setting the address fields first and set
net_mode=0last; for DHCP, onlynet_mode=1is needed. - Connection drop: Changing the IP / mask / gateway invalidates the current connection; reconnect using the new address.
- Token requirement: All network settings endpoints require a valid token; for how to obtain one, see the Login API guide.