*Examples – Change camera name

Configuration Article | CA-20220907-TP-79

VDG Sense | API | References

The name of a camera can be changed with the executeAction command. This command executes a particular action on the server. The command requires a XML message as post data. This XML message holds all parameters for the action.

Set camera name

Sets the camera name of camera with serverid 8712348723918719871 and deviceid 3 to “MyCamera”.

Command url:

http://<server>/command?command=executeAction

Post data:

<!--?xml version="1.0"?-->  <action>   <name>camera.setDeviceSetting</name>   <parameters>     <parameter name="serverid">8712348723918719871</parameter>     <parameter name="deviceid">3</parameter>     <parameter name="name">CameraName</parameter>     <parameter name="value">MyCamera</parameter>   </parameters>  </action>

Result:

<result errorcode="0">   <description>Ok</description>  </result>

Check camera name

To see if the camera name is set correctly issue the command getDeviceList.

Command url:

http://<server>/command?command=getDeviceList

Result:

<result errorcode="0">   <devices count="4">     <device>       <name>Lab</name>       <serverid>7015498111931795223</serverid>       <deviceid>1</deviceid>       <status>ConnectionLost</status>       <type>camera</type>     </device>     <device>       <name>Dome</name>       <serverid>7015498111931795223</serverid>       <deviceid>2</deviceid>       <status>CameraNormal</status>       <type>camera</type>     </device>     <device>       <name>192.168.203.80</name>       <serverid>8712348723918719871</serverid>       <deviceid>1</deviceid>       <status>CameraNormal</status>       <type>camera</type>     </device>     <device>       <name>MyCamera</name>       <serverid>8712348723918719871</serverid>       <deviceid>3</deviceid>       <status>CameraNormal</status>       <type>camera</type>     </device>   </devices>  </result>

Non existing device

What happens when we address a device that doesn’t exists?

Command url:

http://<server>/command?command=executeAction

Post data:

<!--?xml version="1.0"?--> <action>   <name>camera.setDeviceSetting</name>   <parameters>     <parameter name="serverid">8712348723918719871</parameter>     <parameter name="deviceid">4</parameter>     <parameter name="name">CameraName</parameter>     <parameter name="value">MyCamera</parameter>   </parameters>  </action>

Result:

<result errorcode="-2">   <description>No device</description>  </result>

 

Related content