CGI & Postman User Guide – Generic Workflow for Network Camera Configuration

CGI & Postman User Guide of Network Camera

Overview

This guide explains the generic workflow for interacting with your network camera’s CGI interface using Postman. The same method applies to any CGI‑based configuration – audio, video, network, events, PTZ, etc.

If you are looking for a specific example (e.g., disabling audio or changing video resolution), please refer to the related Example articles in this CGI section. This guide focuses on the reusable method.

1. Prerequisites

  1. Postman installed – Download here
  2. Network camera IP address, username, password (example: 192.168.1.120, admin, 12345)
  3. Your camera must support the following CGI endpoints:
    1. Get configuration – GET /action/get?subject=XXX&user=admin&pwd=12345
    2. Set configuration – POST /action/set?subject=XXX&user=admin&pwd=12345 with XML body

2. The Generic Workflow (Step-by-Step)

Step 1 – Get Current Configuration (GET)

Always start by retrieving the current values. This gives you the correct XML structure and the existing parameters.
  1. In Postman, create a new request.
  2. Set method to GET.
  3. Enter the URL with your camera’s IP, username, and password: http://192.168.1.120/action/get?subject=audioenc&user=admin&pwd=12345 (replace audioenc with the subject you need, e.g., videoenc, network, event)
  4. Click Send.
  5. Copy the entire XML response. It will look like:
<?xml version="1.0" encoding="utf-8"?>
<response>
    <audioenc ver="2.0">
        <active>1</active>
        <codec>0</codec>
        <sample>8000</sample>
        <bitwidth>16</bitwidth>
        <bitrate>16000</bitrate>
        <channel>0</channel>
        <input>1</input>
    </audioenc>
</response>

Step 2 – Prepare the SET Request (POST)

  1. Create a new request in Postman.
  2. Set method to POST.
  3. Enter the SET URL (authentication in URL): http://192.168.1.120/action/set?subject=audioenc&user=admin&pwd=12345.
  4. Go to the Headers tab and add: Content-Type: application/xml
  5. Go to the Body tab → select raw → choose XML from the dropdown.
  6. Build the XML payload using this template:
<?xml version="1.0" encoding="utf-8"?>
<request>
    <audioenc>
        <active>0</active>
        <codec>0</codec>
        <sample>8000</sample>
        <bitwidth>16</bitwidth>
        <bitrate>16000</bitrate>
        <channel>0</channel>
        <input>1</input>
    </audioenc>
</request>

Notes
Critical rules:
  1. Root element must be <request>.
  2. The inner tag (e.g., <audioenc>) must exactly match the one returned by GET (could be <audience>, <videoenc>, etc.).
  3. Include all child parameters – do not send only the field you want to change.
  4. Modify only the values you need (e.g., change <active>1</active> to <active>0</active>).

Step 3 – Send the POST Request

Click Send. A successful response typically returns:
200: Succeed to Set.

If you receive an error, see the Error Handling section below.

Step 4 – Verify the Change

Repeat the GET request (Step 1) and confirm that the modified value has been applied.

3. Error Handling

HTTP Status / Response
Meaning
Likely Cause & Solution
200: Succeed to Set.
Success
-
400: Error to Request.
Bad request
XML malformed, missing tags, or incorrect tag names. Check that you used the exact structure from GET.
403: No authorized.
Authentication failed
Wrong username/password. If camera uses Digest Auth, set Postman’s Authorization type to “Digest Auth”.
500: Failed to Set.
Internal error
One or more parameter values are invalid (out of range, unsupported combination). Compare with the GET response values.

4. Best Practices with Postman

Save Requests as a Collection

  1. After configuring a GET or POST request, click Save.
  2. Create a new Collection (e.g., Camera CGI) and save both requests inside it.
  3. You can now reuse them anytime without re‑entering URLs or XML bodies.

Use Environment Variables

Avoid hardcoding IP, username, and password in every request:
1. Click the Environment quick look icon (eye icon) → Edit → Add.
2. Create variables:
  1. {{baseUrl}} = http://192.168.1.120
  2. {{user}} = admin
  3. {{pwd}} = 12345
3. In your requests, use:
  1. GET: {{baseUrl}}/action/get?subject=audioenc&user={{user}}&pwd={{pwd}}
  2. POST: {{baseUrl}}/action/set?subject=audioenc&user={{user}}&pwd={{pwd}}
Now you can switch cameras by changing the environment variables.

5. Learn More

Now that you understand the generic method, explore the example articles in this CGI section:
  1. Example: Audio Configuration (Enable/Disable, Codec, Sample Rate)-->Updating
  2. …and more.
Each example follows the exact same workflow, only the XML content changes.