Figuring out Hikvision API / ISAPI

Robert G.

Getting comfortable
Joined
Oct 6, 2018
Messages
296
Reaction score
567
Location
North America
I have been using the Hikvision API on a pair of DS-2CD2345FWD-I cameras. Based on some code I found online I was able to determine how to connect, authenticate & inject a text overlay onto the camera interface. This has worked great for about 1 year, never an issue. Here is a snapshot showing is is currently -1.


AptB.jpg

I'm looking to expand my use of the API, would like to make adjustments based on the time of year. In the winter it is dark by 4pm but in the summer it is light until 10pm so making slight adjustments every day based on sunrise/sunset would be very nice.

I found a 600 page API User Guide (version 2.6 from 2009) but can't figure out how to talk to the camera to determine what the URL/command would be to see what the camera exposes.

Not sure that makes any sense... Essentially, how do I find out the URL to make changes?

To inject the temperature, I speak to:


At that URL I PUT a bit of XML and bingo, bango it works.

Yesterday I tried to reverse engineer, knowing what the URL was that I am speaking to, see if I could find that documented and possibly figure out other URL's to speak to but no luck.

Anyone have any bits of genius they can share?
 

watchful_ip

Pulling my weight
Joined
Nov 24, 2019
Messages
251
Reaction score
226
Location
london
When you say "making slight adjustments every day based on sunrise/sunset would be very nice" do you mean switching between day/night modes on the camera?

I know there used to be scripts for that. What are you trying to do specifically?

Have you tried looking at the davinci binary for clues? E.g:

Code:
/ISAPI/System/Video/inputs/channels/1/focus
/ISAPI/Smart/IntelliTrace
/ISAPI/System/Video/inputs/channels/1/iris
/ISAPI/Image/channels/1/proportionalpan
/ISAPI/Image/channels/1/imageFreeze
/ISAPI/System/Video/inputs/channels/1/privacyMask
 

Robert G.

Getting comfortable
Joined
Oct 6, 2018
Messages
296
Reaction score
567
Location
North America
Well, specifically right now I am trying to figure out how to change the scheduled image settings time, via API so I could adjust the time that the camera will switch the image display settings.

scheduled_image_settings.jpg

Every Hikvision camera has a different featureset, making the API quite difficult it seems.
 

watchful_ip

Pulling my weight
Joined
Nov 24, 2019
Messages
251
Reaction score
226
Location
london
Tried using wireshark or chrome dev tools and seeing what the webpages do when you change it that way?
 

rearanger

Getting the hang of it
Joined
Feb 10, 2016
Messages
224
Reaction score
96
Location
Scottish Borders
Below is a small part of websdk.js That should give you some help regarding ISAPI

websdk.js is contained within digicap.dav or can be pulled from a live cam if you have root.


{url:"%s%s:%s/ISAPI/Security/sessionLogin/capabilities"},sessionLogin:
{url:"%s%s:%s/ISAPI/Security/sessionLogin?timeStamp=%s",req:[PARAM_OPTION_TIMESTAMP]},sessionHeartbeat:
{url:"%s%s:%s/ISAPI/Security/sessionHeartbeat"},sessionLogout:
{url:"%s%s:%s/ISAPI/Security/sessionLogout"},login:
{url:"%s%s:%s/ISAPI/Security/userCheck?timeStamp=%s",req:[PARAM_OPTION_TIMESTAMP]},securityCap:
{url:"%s%s:%s/ISAPI/Security/capabilities"},securityExtCap:
{url:"%s%s:%s/ISAPI/Security/extern/capabilities"},questionInfoList:
{url:"%s%s:%s/ISAPI/Security/questionConfiguration",security1:["answer","password"]},loginNumber: {url:"%s%s:%s/ISAPI/Security/loginLinkNum?format=json",security1:["adminPassword"]},questionInfo: {url:"%s%s:%s/ISAPI/Security/questionConfiguration/%s",req:[PARAM_OPTION_QAID],security1:["answer"]},questionAuth: {url:"%s%s:%s/ISAPI/Security/questionCertification",security1:["answer"]},loginPwdCheck:
{url:"%s%s:%s/ISAPI/Security/loginPassword",security1:["password"]},challenge: {url:"%s%s:%s/ISAPI/Security/challenge"},activateStatus:{url:"%s%s:%s/SDK/activateStatus"},activate: {url:"%s%s:%s/ISAPI/System/activate"},activateIPC: {url:"%s%s:%s/ISAPI/ContentMgmt/InputProxy/channels/activate",security1:["userName","password"]},sHttpCapa:{url:"%s%s:%s/SDK/capabilities"},deviceCapa:
{url:"%s%s:%s/ISAPI/System/capabilities"},deviceInfoCapa:
 

StewartM

Getting the hang of it
Joined
Dec 11, 2017
Messages
260
Reaction score
75
Location
Cape Town
You can set the schedule via a PUT request. This should work provided you have CGI enabled and created a user with admin privileges.
The following uses the Talend API extension for Chrome.
PUT Body:
<?xml version="1.0" encoding="UTF-8"?>
<IrcutFilter>
<IrcutFilterType>schedule</IrcutFilterType>
<Schedule>
<scheduleType>day</scheduleType>
<TimeRange>
<beginTime>07:00:00</beginTime>
<endTime>18:00:00</endTime>
</TimeRange>
</Schedule>
<nightToDayFilterLevel>4</nightToDayFilterLevel>
<nightToDayFilterTime>5</nightToDayFilterTime>
</IrcutFilter>
1575838896785.png
 

Robert G.

Getting comfortable
Joined
Oct 6, 2018
Messages
296
Reaction score
567
Location
North America
@StewartM AH! Very nice. That Google plugin, plus a bit of network monitoring I found it.

The camera I am working with has a different scheduling system, to switch stuff.

I needed to PUT to a different URL:


With this snippet of XML:

<?xml version: "1.0" encoding="UTF-8"?>
<ISPMode>
<mode>schedule</mode>
<Schedule><scheduleType>day</scheduleType>
<TimeRange>
<beginTime>07:00:00</beginTime>
<endTime>16:30:00</endTime>
</TimeRange>
</Schedule>
</ISPMode>

Seems the network traffic monitoring, seeing how the camera's own GUI interacts with the API is the best way to figure out what is needed.

Now that I've got these puzzle pieces put together, thanks to all the input, it is time to start making some adjustments based on sunrise/sunset.
 

shbatm

n3wb
Joined
Jan 11, 2020
Messages
3
Reaction score
0
Location
Houston, TX
@Robert G. Came here looking for some links to a formal API documentation, but I did want to share how I've reverse engineered what I needed so far:

I make extensive use of the Network tab in Chrome DevTools to capture the exchanges between the browser and the web interface. For example, to enable/disable line crossing: I would open the web gui, and Chrome DevTools (Ctrl+Shift+I) to the Network tab. Then I would enable line crossing exactly how I want it in the Web Config, and save any responses that come across through the network tab. Then I disable it in the web config and watch for the next response. After a few times of playing with the settings I need to change, I just save the different response templates and use `curl` scripts to execute the changes I need.
 

iTuneDVR

Pulling my weight
Joined
Aug 23, 2014
Messages
846
Reaction score
153
Location
Россия
Sorry, try put some files in order and removed;)
Here
 
Last edited:

Please enter the name by

Young grasshopper
Joined
Nov 28, 2014
Messages
75
Reaction score
4
HiI saw i can manang my device to.
Is there some other way to foce my device to put out some data?
There is NO(!) normal Webpage when I add the URL!
Thanks
 

Please enter the name by

Young grasshopper
Joined
Nov 28, 2014
Messages
75
Reaction score
4
Its the Bodycam.
XML:
<CPUList>
<CPU>
<cpuDescription>ARM926EJ-Sid(wb) [41069265] revision 5 (ARMv5TEJ)</cpuDescription>
<cpuUtilization>34</cpuUtilization>
</CPU>
</CPUList>
<MemoryList>
<Memory>
<memoryDescription>DDR Memory</memoryDescription>
<memoryUsage>72</memoryUsage>
<memoryAvailable>89476</memoryAvailable>
</Memory>
</MemoryList>
XML:
<DeviceCap version="2.0">
<script/>
<SysCap>
<NetworkCap version="2.0">
<isSupportWireless>true</isSupportWireless>
<isSupportPPPoE>false</isSupportPPPoE>
<isSupportBond>false</isSupportBond>
<isSupport802_1x>false</isSupport802_1x>
<isSupportNtp>false</isSupportNtp>
<isSupportFtp>true</isSupportFtp>
<isSupportUpnp>false</isSupportUpnp>
<isSupportDdns>false</isSupportDdns>
<isSupportHttps>false</isSupportHttps>
<SnmpCap>
<isSupport>false</isSupport>
</SnmpCap>
<isSupportIPFilter>true</isSupportIPFilter>
<isSupportEZVIZ>true</isSupportEZVIZ>
<isSupportWirelessServer>false</isSupportWirelessServer>
<isSupportGPS>true</isSupportGPS>
<isSupportWirelessDial>false</isSupportWirelessDial>
<isSupportEhome>true</isSupportEhome>
<isSupportBluetooth>false</isSupportBluetooth>
<isSupportQos>true</isSupportQos>
<isSupportSmtp>false</isSupportSmtp>
<GB28181Cap>
<isSupportGB28181Service>false</isSupportGB28181Service>
</GB28181Cap>
</NetworkCap>
<IOCap version="2.0">
<IOInputPortNums>0</IOInputPortNums>
<IOOutputPortNums>0</IOOutputPortNums>
<isSupportStrobeLamp>false</isSupportStrobeLamp>
</IOCap>
<VideoCap version="2.0">
<videoInputPortNums>0</videoInputPortNums>
<videoOutputPortNums>1</videoOutputPortNums>
</VideoCap>
<AudioCap version="2.0">
<audioInputNums>1</audioInputNums>
<audioOutputNums>1</audioOutputNums>
</AudioCap>
</SysCap>
<voicetalkNums>1</voicetalkNums>
<isSupportSnapshot>true</isSupportSnapshot>
<SecurityCap version="2.0">
<supportUserNums>32</supportUserNums>
<userBondIpNums>0</userBondIpNums>
<userBondMacNums>0</userBondMacNums>
</SecurityCap>
<EventCap version="2.0">
<isSupportHDFull>true</isSupportHDFull>
<isSupportHDError>true</isSupportHDError>
<isSupportNicBroken>true</isSupportNicBroken>
<isSupportIpConflict>true</isSupportIpConflict>
<isSupportIllAccess>true</isSupportIllAccess>
<isSupportViException>false</isSupportViException>
<isSupportViMismatch>false</isSupportViMismatch>
<isSupportRecordException>false</isSupportRecordException>
<isSupportTriggerFocus>false</isSupportTriggerFocus>
<isSupportMotionDetection>false</isSupportMotionDetection>
<isSupportTamperDetection>false</isSupportTamperDetection>
</EventCap>
<SmartCap version="2.0">
<isSupportROI>false</isSupportROI>
<isSupportFaceDetect>false</isSupportFaceDetect>
<isSupportIntelliTrace>false</isSupportIntelliTrace>
<isSupportFieldDetection>false</isSupportFieldDetection>
<isSupportDefocusDetection>false</isSupportDefocusDetection>
<isSupportAudioDetection>false</isSupportAudioDetection>
<isSupportSceneChangeDetection>false</isSupportSceneChangeDetection>
</SmartCap>
<WLAlarmCap version="2.0">
<isSupportPIR>false</isSupportPIR>
<isSupportWLSensors>false</isSupportWLSensors>
<isSupportCallHelp>false</isSupportCallHelp>
</WLAlarmCap>
</DeviceCap>
XML:
<EventCap version="2.0">
<script/>
<isSupportHDFull>true</isSupportHDFull>
<isSupportHDError>true</isSupportHDError>
<isSupportNicBroken>true</isSupportNicBroken>
<isSupportIpConflict>true</isSupportIpConflict>
<isSupportIllAccess>true</isSupportIllAccess>
<isSupportViException>false</isSupportViException>
<isSupportViMismatch>false</isSupportViMismatch>
<isSupportRecordException>false</isSupportRecordException>
<isSupportTriggerFocus>false</isSupportTriggerFocus>
<isSupportMotionDetection>false</isSupportMotionDetection>
<isSupportTamperDetection>false</isSupportTamperDetection>
</EventCap>
XML:
<DeviceInfo version="2.0">
<script/>
<deviceName>------</deviceName>
<deviceID>-------ffffffffffff</deviceID>
<deviceDescription>IPDome</deviceDescription>
<deviceLocation>hangzhou</deviceLocation>
<systemContact>Hikvision.China</systemContact>
<model>-----</model>
<serialNumber>----</serialNumber>
<macAddress>-:-:-:-:-:-</macAddress>
<firmwareVersion>V1.2.0</firmwareVersion>
<firmwareReleasedDate> build 190808</firmwareReleasedDate>
<encoderVersion>V7.3</encoderVersion>
<encoderReleasedDate>build 190807</encoderReleasedDate>
<bootVersion>V1.3.4</bootVersion>
<bootReleasedDate>100316</bootReleasedDate>
<hardwareVersion>0x0</hardwareVersion>
<deviceType>IPDome</deviceType>
<telecontrolID>88</telecontrolID>
<supportBeep>false</supportBeep>
<supportVideoLoss>false</supportVideoLoss>
</DeviceInfo>
 

iTuneDVR

Pulling my weight
Joined
Aug 23, 2014
Messages
846
Reaction score
153
Location
Россия
Ok
What you want to see this as normal formated tex at web page your body cam or ...?
 

Please enter the name by

Young grasshopper
Joined
Nov 28, 2014
Messages
75
Reaction score
4
No
The have no Webpage. The Webserver just output a XML for example:
XML:
<VideoInput version="2.0">
<script/>
<VideoInputChannelList version="2.0">
<VideoInputChannel version="2.0">
<id>1</id>
<inputPort>1</inputPort>
<name/>
<videoFormat>PAL</videoFormat>
</VideoInputChannel>
</VideoInputChannelList>
</VideoInput>
The GUI from that device is very rudimentary. I can just set some settings. The intend that a user buy the Dock Station Dock Station for body worn camera-HIKVISION Latinoamérica think who is just a W10 Pc with a Cradle (who sold separate to!). The Software for that "pc" can be download and installed even on a W7 Machine but the require a HW Dongle.
 

iTuneDVR

Pulling my weight
Joined
Aug 23, 2014
Messages
846
Reaction score
153
Location
Россия
What parameters require frequent reconfiguration?
If you use scripts, is this not a temporary exit from the situation, and then you can write a shell and also run these scripts by passing the necessary parameters.
Everything is in your hands, but maybe there is software that can do this.
 

Please enter the name by

Young grasshopper
Joined
Nov 28, 2014
Messages
75
Reaction score
4
What parameters require frequent reconfiguration?
Well the problem is I cant change that many settings on my Bodycam. There is no Web GUI like a normal Cam have.
And hikvision thinks, say,... I should buy, use there "Server" - PC with the "BodyCameraStation" Software on it who I guess the use the same as we try.

There is a damn cool option I will use later:
8.3 Start Two-Way Audio
Page 83:
For that I must send Audio to my device. Is there an easy way for?
 

iTuneDVR

Pulling my weight
Joined
Aug 23, 2014
Messages
846
Reaction score
153
Location
Россия
Well the problem is I cant change that many settings on my Bodycam. There is no Web GUI like a normal Cam have.
And hikvision thinks, say,... I should buy, use there "Server" - PC with the "BodyCameraStation" Software on it who I guess the use the same as we try.
It' not good

There is a damn cool option I will use later:
8.3 Start Two-Way Audio
Page 83: https://www.hikvision.com/content/dam/hikvision/en/support/download/firmware/firmware-with-cc/Hikvision ISAPI Core Protocol.pdf
For that I must send Audio to my device. Is there an easy way for?
Start more easy than send audio data (file)
Try ClientDemo to check this device & audio talk
 
Top