In this article, we'll show you how to configure the alarm server option for a Hikvision IP camera via ISAPI.
For this example, we'll use the following data:
Camera IP: 192.168.50.37
Camera user: admin
Camera password: Syscom2025
1. Check camera capabilities
First we must use the following endpoint to validate that the camera does support the function:
Request:
curl --digest -u admin:Syscom2025 --location '192.168.50.37/ISAPI/Event/notification/httpHosts/capabilities'
Response:
<?xml version="1.0" encoding="UTF-8"?>
<HttpHostNotificationCap version="2.0" xmlns="http://www.hikvision.com/ver20/XMLSchema">
<hostNumber>3</hostNumber>
<urlLen min="1" max="128"/>
<protocolType opt="HTTP,HTTPS,EHome"/>
<parameterFormatType opt="XML,JSON"/>
<addressingFormatType opt="ipaddress,hostname"/>
<ipAddress opt="ipv4,ipv6"/>
<portNo min="1" max="65535"/>
<userNameLen min="1" max="32"/>
<passwordLen min="1" max="16"/>
<httpAuthenticationMethod opt="none,base64"/>
<uploadImagesDataType opt="URL,binary"/>
<httpBroken opt="true,false" def="true"/>
</HttpHostNotificationCap>
In this example the camera can register up to 3 hosts, using either http or https.
2. View configured hosts
If we want to see which hosts are configured, we use the following endpoint:
Request:
curl --digest -u admin:Syscom2025 --location '192.168.50.37/ISAPI/Event/notification/httpHosts'
Response:
<?xml version="1.0" encoding="UTF-8"?>
<HttpHostNotificationList version="2.0" xmlns="http://www.hikvision.com/ver20/XMLSchema">
<HttpHostNotification version="2.0" xmlns="http://www.hikvision.com/ver20/XMLSchema">
<id>1</id>
<url>/</url>
<protocolType>HTTP</protocolType>
<parameterFormatType>XML</parameterFormatType>
<addressingFormatType>ipaddress</addressingFormatType>
<ipAddress>0.0.0.0</ipAddress>
<portNo>80</portNo>
<userName></userName>
<httpAuthenticationMethod>none</httpAuthenticationMethod>
<httpBroken>true</httpBroken>
</HttpHostNotification>
<HttpHostNotification version="2.0" xmlns="http://www.hikvision.com/ver20/XMLSchema">
<id>2</id>
<url>/</url>
<protocolType>HTTP</protocolType>
<parameterFormatType>XML</parameterFormatType>
<addressingFormatType>ipaddress</addressingFormatType>
<ipAddress>0.0.0.0</ipAddress>
<portNo>80</portNo>
<userName></userName>
<httpAuthenticationMethod>none</httpAuthenticationMethod>
<httpBroken>true</httpBroken>
</HttpHostNotification>
<HttpHostNotification version="2.0" xmlns="http://www.hikvision.com/ver20/XMLSchema">
<id>3</id>
<url>/</url>
<protocolType>HTTP</protocolType>
<parameterFormatType>XML</parameterFormatType>
<addressingFormatType>ipaddress</addressingFormatType>
<ipAddress>0.0.0.0</ipAddress>
<portNo>80</portNo>
<userName></userName>
<httpAuthenticationMethod>none</httpAuthenticationMethod>
<httpBroken>true</httpBroken>
</HttpHostNotification>
</HttpHostNotificationList>
3. Configure by hostname
To configure it using hostname, we must do the following:
Request:
curl --digest -u admin:Syscom2025 --location --request PUT '192.168.50.37/ISAPI/Event/notification/httpHosts/1' \
--header 'Content-Type: application/xml' \
--data '<?xml version="1.0" encoding="UTF-8"?>
<HttpHostNotificationList xmlns="http://www.isapi.org/ver20/XMLSchema" version="2.0">
<HttpHostNotification>
<id>1</id>
<url>/lectura</url>
<protocolType>HTTPS</protocolType>
<parameterFormatType>XML</parameterFormatType>
<addressingFormatType>hostname</addressingFormatType>
<hostName>ingenieria.syscom.mx</hostName>
<portNo>443</portNo>
<httpAuthenticationMethod>none</httpAuthenticationMethod>
<SubscribeEvent>
<heartbeat>30</heartbeat>
<eventMode>all</eventMode>
</SubscribeEvent>
</HttpHostNotification>
</HttpHostNotificationList>'
Response:
<?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>
4. Configure by IP Address
To configure it using an IP address, we must do the following:
Request:
curl --digest -u admin:Syscom2025. --location --request PUT '192.168.50.37/ISAPI/Event/notification/httpHosts/1' \
--header 'Content-Type: application/xml' \
--data '<?xml version="1.0" encoding="UTF-8"?>
<HttpHostNotificationList xmlns="http://www.isapi.org/ver20/XMLSchema" version="2.0">
<HttpHostNotification>
<id>1</id>
<url>/lectura</url>
<protocolType>HTTP</protocolType>
<parameterFormatType>XML</parameterFormatType>
<addressingFormatType>ipaddress</addressingFormatType>
<ipAddress>192.168.50.253</ipAddress>
<portNo>8090</portNo>
<httpAuthenticationMethod>none</httpAuthenticationMethod>
<SubscribeEvent>
<heartbeat>30</heartbeat>
<eventMode>all</eventMode>
</SubscribeEvent>
</HttpHostNotification>
</HttpHostNotificationList>'
Response:
<?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>
5. Extra
We can download the Demo - Event Receiver via HTTP project to validate the sending of events and to inspect the content.