DEV Community

Dmitry Gordin
Dmitry Gordin

Posted on

47 2

Hikvision camera configuration via ISAPI

Hikvision company makes good cameras and terrible documentation for their software.
If you've ended up here, chances are you've tried digging through their "isapi.pdf" file and didn't find much help there.

First, I'd suggest you get your camera set up via the web interface. Next, grab a reference template of the settings in XML format. Do it by opening in you browser:

In case you have different models of cameras, probably you need to get this templates from all of them, compare, and find common basis.

To deploy this config to camera simply PUT this xml text to camera by the same url!

Sample python code:

import requests
from requests.auth import HTTPDigestAuth

username, password = ('admin', 'camera_password')
stream_xml = """
<StreamingChannel version="2.0" xmlns="http://www.hikvision.com/ver20/XMLSchema">
    <id>1</id>
blah blah blah
"""
url = "http://192.168.1.64/ISAPI/Streaming/channels/1"
response = requests.put(url, data=stream_xml, auth=HTTPDigestAuth(username, password))
print(response.text)
assert response.status_code == 200

image_xml = """
<ImageChannel xmlns="http://www.hikvision.com/ver20/XMLSchema" version="2.0">
    <id>1</id>
    <enabled>true</enabled>
    <videoInputID>1</videoInputID>
"""
url = "http://192.168.1.64/ISAPI/Image/channels/1"
response = requests.put(url, data=image_xml, auth=HTTPDigestAuth(username, password))
print(response.text)
assert response.status_code == 200
Enter fullscreen mode Exit fullscreen mode

You should get response like:

<?xml version="1.0" encoding="UTF-8"?>
<ResponseStatus version="2.0" xmlns="http://www.hikvision.com/ver20/XMLSchema">
<requestURL></requestURL>
<statusCode>1</statusCode>
<statusString>OK</statusString>
<subStatusCode>ok</subStatusCode>
</ResponseStatus>
Enter fullscreen mode Exit fullscreen mode

In more complex case, when you need different configs for each camera model, use: http://192.168.1.64/ISAPI/System/deviceInfo to find out camera model.

Billboard image

Monitor more than uptime.

With Checkly, you can use Playwright tests and Javascript to monitor end-to-end scenarios in your NextJS, Astro, Remix, or other application.

Get started now!

Top comments (3)

Collapse
 
cibermesias profile image
Allfarid Morales García

Every URI I've tested so far returns this exact XML:
<ResponseStatus xmlns="http://www.hikvision.com/ver10/XMLSchema" version="1.0">
<script/>
<requestURL/>
<statusCode>4</statusCode>
<statusString>Invalid Operation</statusString>
<subStatusCode>notSupport</subStatusCode>
<errorCode>1073741825</errorCode>
<errorMsg>notSupport</errorMsg>
</ResponseStatus>

What am I doing wrong?

Collapse
 
eduardo_guimaraes_e4c1fc3 profile image
Eduardo Guimaraes

Please I need a help to zoom in

Collapse
 
gordinmitya profile image
Dmitry Gordin

me too

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Discover a treasure trove of wisdom within this insightful piece, highly respected in the nurturing DEV Community enviroment. Developers, whether novice or expert, are encouraged to participate and add to our shared knowledge basin.

A simple "thank you" can illuminate someone's day. Express your appreciation in the comments section!

On DEV, sharing ideas smoothens our journey and strengthens our community ties. Learn something useful? Offering a quick thanks to the author is deeply appreciated.

Okay