API Reference · v1.0

Network Settings API

Describes how to read and configure the camera's Ethernet parameters (DHCP / static IP, subnet mask, gateway, DNS, hostname) over HTTP/HTTPS.

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:

  1. First log in to obtain a token (token) — see the Login API guide.
  2. Set each network option as needed: for a static IP, first configure the IP / mask / gateway / DNS.
  3. Finally, set net_mode (0 = static, 1 = DHCP) to trigger the apply.
  4. Once the device applies the settings, it operates with the new configuration; after switching the IP, reconnect using the new address.
Changing IP-related settings will drop the current connection. Be sure to record the new address to avoid losing access.

2Connection Information

ProtocolDefault PortBase URL
HTTP80http://<camera-ip>/
HTTPS443https://<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 KeyTypeDescriptionExample / Default
net_modeintegerNetwork mode: 0 = static IP, 1 = DHCP1 (DHCP)
net_ipv4stringStatic IPv4 address192.168.1.168
net_maskstringSubnet mask255.255.255.0
net_gatewaystringDefault gateway192.168.1.254
net_dnsstringDNS server168.95.1.1
Integer options are sent as 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.

POST/set_stringAuth required

Sets a string-type network option (such as net_ipv4, net_mask, net_gateway, net_dns).

Request Parameters

FieldTypeRequiredDescription
methodstringYesFixed value "SetString"
optionstringYesOption key, such as net_ipv4
valuestringYesOption 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 }
POST/set_optionAuth required

Sets an integer-type network option (such as net_mode).

Request Parameters

FieldTypeRequiredDescription
methodstringYesFixed value "Set"
optionstringYesOption key, such as net_mode
valueintYesOption 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 }
Setting net_mode is the action that actually triggers the network apply, so in static mode be sure to set it last.
POST/get_optionAuth required

Reads the current value of a single option. Use method: "Get" for integer options; use method: "GetString" for string options.

Request Parameters

FieldTypeRequiredDescription
methodstringYes"Get" (integer) or "GetString" (string)
optionstringYesOption 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 }
GET/cgi-bin?SubNetwork=<ip>Compatibility use

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
The secondary IP mask is fixed at /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"}'
After the static IP is applied, the original connection address becomes invalid. From Step 3 onward, call using the newly configured IP; the token remains unchanged (unless the password has been changed).

7Responses and Error Codes

All responses use a unified JSON structure:

{ "code": <http_status>, "msg": "<message>", "data": <payload> }
HTTPMessageMeaning
200okSuccess. data is the read value or null
400invalid paramsMalformed request, a required field is missing, or the option is a restricted option
401token malformed / failedToken is missing, malformed, or not accepted
401token password errorToken is invalid (usually because the password has changed); log in again
500—Device-side configuration failed or is not yet ready

8Notes