Sommario   Guida in linea MOBOTIX

The Remote Configuration API

The remote configuration API (Application Programming Interface) http://192.168.1.225/admin/remoteconfig provides the methods used for remotely changing configuration parameters directly on the MOBOTIX camera.

Using the Remote Configuration API

The camera's HTTP interface processes commands and configuration parameters in an HTTP POST request as in the following example:

POST /admin/remoteconfig HTTP/1.0
Content-type: application/x-www-form-urlencoded
Authorization: Basic YWRtaW46bWVpbnNt
Content-length: 87

helo
view section audio
write params
audio/MICRO=1
view section audio
store
update
quit

Explanation of the HTTP POST Request in the Example

Part Description
POST /admin/remoteconfig HTTP/1.0
Content-type: application/x-www-form-urlencoded
Authorization: Basic YWRtaW46bWVpbnNt
Content-length: 87

Header of the HTTP POST Request.

  Empty line; separates the request's header from its content.
helo Beginning of the command sequence.
view section audio
write params
audio/MICRO=1
view section audio
store
update
Command sequence with specific commands, as described in the Commands of the Remote Configuration API section.
quit End of the command sequence.

Remarks:

This example is discussed in detail in Output of the Remote Configuration API using the cURL command line application.

Commands of the Remote Configuration API

You can use the commands as shown in the following syntax samples:

The Remote Configuration API provides the following commands:

Command Description
reset Resets the entire camera configuration or individual sections thereof to the factory default values.
Keyword Result
configfile Resets the entire configuration.
section Only resets the sections of the configuration that are specified as parameters.
exceptsection Resets all sections of the configuration except the ones specified as parameters.
restore Restores the configuration from the copy in Flash storage.
Keyword Result
configfile Restores the entire configuration.
section Only restores the sections of the configuration that are specified as parameters.
delete Deletes the entire configuration, specific sections or individual parameters.
Keyword Result
configfile Deletes the entire configuration.
section Only deletes the sections of the configuration that are specified as parameters.
params Only deletes the parameters of the configuration that are specified in the following lines. The parameters for deletion are specified by the section name followed by "/" as separator:

<section name>/<parameter>

When dealing with profiles, the profile name is expanding the section name, again separated by a "/".

<section name>/<profile name>/<parameter>

write Deletes entire sections or - when used with the params keyword in front, individual parameters of the configuration.
Keyword Result

(not specified)

Writes the sections of the configuration that are specified in the following lines. Note that the sections need to be specified with start and end lines:

SECTION <section name1>
<parameter>=<value>
<parameter>=<value>
ENDSECTION <section name1>
SECTION <section name2>
<parameter>=<value>
ENDSECTION <section name2>

params

Writes the parameters of the configuration that are specified in the following lines. The parameters are specified by the section name followed by "/" as separator:

<section name>/<parameter>=<value>

When dealing with profiles, the profile name is expanding the section name, again separated by a "/".

<section name>/<profile name>/<parameter>=<value>

append Appends data to configuration sections. The parameters to append to a section are specified line by line between SECTION and ENDSECTION as in the following:

SECTION <section name>
Parameter=<value>
Parameter=<value>
ENDSECTION <section name>

view Returns (shows) the entire configuration or specific sections.
Keyword Result
configfile Returns the entire configuration.
section Only returns the sections of the configuration that are specified as parameters.
store Stores the configuration in the camera's flash memory.
reboot Reboots the camera.
update Applies all changes to the configuration that can be activated without rebooting the camera.
Keyword Result
all (or without keyword) Activates all changes.
section Only applies the changes to the sections that are specified as parameters.
profile Returns one line with the name of the current configuration profile. This line is empty, if no profile is active.
activate_profile Activates the configuration profile specified as parameter:

activate_profile <profile name>

reboot_needed Returns all changed configuration sections, which require a reboot before they can be applied. This line is empty, if no change requires a reboot.

Note: After changing the entire configuration (using write, reset, delete or after uploading/editing the configuration from the web interface), the camera does not know if certain configuration sections have been changed. In this case, the command returns the answer "unknown".

exit
quit
Identical meaning. Both commands end the preceding command and close the API command sequence. Note that you can only use one of these two commands in a command sequence.
help Returns a list of available commands (see Returning a List of Commands Using help).

Output of the Remote Configuration API

The camera API returns its answers line by line:

Example: Activating the Microphone

This example demonstrates how to activate the microphone using an HTTP request. For easily testing the remote configuration API, the cURL command line tool (http://curl.haxx.se/download.html) can be downloaded for Windows. It is automatically installed on Mac OS X and most Linux computers.

Using cURL allows quickly and easily testing the commands, since this tool handles the communication with the camera. For example, cURL automatically sends the correct header and calculates the length of the command sequence.

Request to be sent:

Commands Description

helo
view section audio
write params
audio/MICRO=1
view section audio
store
update
quit

# Beginning of the command sequence.
# Output the audio section.
# Write the parameter specified in the following line.
# Set the MICRO parameter in the audio section to the value "1".
# Output audio section once more.
# Store the configuration in the camera's flash memory.
# Apply the changes without rebooting.
# End of the command sequence.

Step-by-step instruction:

Output of the command sequence with the following data:

* About to connect() to 10.8.0.118 port 80 (#0)
* Trying 10.8.0.118... connected
* Connected to 10.8.0.118 port 80 (#0)
* Server auth using Basic with user 'admin'
> POST /admin/remoteconfig HTTP/1.1
> Authorization: Basic YWRtaW46bWVpbnNt
> User-Agent: curl/7.18.2 (i486-pc-linux-gnu) libcurl/7.18.2 OpenSSL/0.9.8g zlib/1.2.3.3 libidn/1.8 libssh2/0.18
> Host: 10.8.0.118
> Accept: */*
> Content-Length: 87
> Content-Type: application/x-www-form-urlencoded
>
* HTTP 1.0, assume close after body
< HTTP/1.0 200 OK
< Content-Type: text/plain; charset=ISO-8859-1
< Cache-Control: no-cache
<
#read:helo:
#read:view section audio:
#exec cmd=view section audio
SECTION audio
SPEAKER=1
MICRO=0
PREAMPLIFIER=2
SPEAKERLEVEL=0
ENDSECTION audio
#read:write params:
#exec cmd=write params
#read:view section audio:
#exec cmd=view section audio
SECTION audio
SPEAKER=1
MICRO=1
PREAMPLIFIER=2
SPEAKERLEVEL=0
ENDSECTION audio
#read:store:
#exec cmd=store
#Storing to flash...
#read:update:
#exec cmd=update
#updating daemons!
#read:quit:
OK
#bye
* Closing connection #0

Note: Output beginning with a "*", "<" or ">" character is generated by cURL. In the output, ">" precedes the commands sent to the camera, while "<" precedes the messages returned by the camera's web server. The remaining lines are returned by the remote configuration API, as described in the Output of the Remote Configuration API section.

Example: Returning a List of Commands Using help

Request to be sent:

Commands Description

helo
help
quit

# Beginning of the command sequence.
# Call the help of the Remote Configuration API
# End of the command sequence.

Step-by-step instruction:

Output of the command sequence with the following data:

* About to connect() to 10.8.0.118 port 80 (#0)
* Trying 10.8.0.118... connected
* Connected to 10.8.0.118 port 80 (#0)
* Server auth using Basic with user 'admin'
> POST /admin/remoteconfig HTTP/1.1
> Authorization: Basic YWRtaW46bWVpbnNt
> User-Agent: curl/7.18.2 (i486-pc-linux-gnu) libcurl/7.18.2 OpenSSL/0.9.8g zlib/1.2.3.3 libidn/1.8 libssh2/0.18
> Host: 10.8.0.118
> Accept: */*
> Content-Length: 87
> Content-Type: application/x-www-form-urlencoded
>
* HTTP 1.0, assume close after body
< HTTP/1.0 200 OK
< Content-Type: text/plain; charset=ISO-8859-1
< Cache-Control: no-cache
<
#read:helo:
#read:help:
The following commands are currently implemented:
append
reboot_needed
view
reboot
write
profile
restore
activate_profile
reset
update
delete
store
exit
quit
help
#read:quit:
OK
#bye
* Closing connection #0

Note: Output beginning with a "*", "<" or ">" character is generated by cURL. In the output, ">" precedes the commands sent to the camera, while "<" precedes the messages returned by the camera's web server. The remaining lines are returned by the remote configuration API, as described in the Output of the Remote Configuration API section.

cn, de, en, es, fr, it, jp

© 2001-2024 MOBOTIX AG, Germany · http://www.mobotix.com/