The CamScripter App is an application running inside the camera on an Axis Camera Application Platform (ACAP) and can automate all CamStreamer applications.
CamScripter App functionality can be controlled using API once the application is installed and licensed.
Documentation of our library and examples of the app can be found on our GitHub.
Read more about API licensing here
Sample API requests to Postman can be downloaded here
Package format of micro-app for CamScripter App
CamScripter package is a .zip file which contains all manifest, node.js scripts, static files for UI (images, frontend js, css,...).
File manifest.json
The manifest.json is required in each package. The file contains a json object with the following attributes:
package_name
, package_menu_name
, package_version
, vendor
, required_camscripter_version
, ui_link
is link to UI (optional)
Main script
The main.js is required in each package. This is the node.js script which is started once the package starts.
Environment variables
Each micro application running in CamScripter App environment has access to the following variables:
HTTP_PORT
see chapter HTTP ProxyHTTP_PORT_PUBLIC
proxy without authorization. See chapter HTTP ProxyINSTALL_PATH
PERSISTENT_DATA_PATH
folder which is suitable for permanent data. All data survive restart of the camera or package upgradePACKAGE_NAME
Libs
All required js libraries should be part of the package.
Package configuration
The PackageConfigurations parameter is used to enable or disable packages. Value is in JSON format.
Example: {"package_name":{"enabled": true}}
Install package
Basic cURL usage:
curl --user USER:PASS -F file=PACKAGE_NAME http://IPADDR[:PORT]/local/camscripter/package/install.cgi
where
USER
is an user name. E.g. rootPASS
is a password . E.g. passIPADDR[:PORT]
is an IP address:port of the camera. E.g. 192.168.1.5
PACKAGE_NAME
is the name of the package on your computer. E.g. clock.zip
Example: curl --user root:pass -F file=@clock.zip http://127.0.0.1:52520/local/camscripter/package/install.cgi
Remove package
http://IPADDR[:PORT]/local/camscripter/package/remove.cgi?package_name=PACKAGE_NAME
where
IPADDR[:PORT]
is an IP address:port of the camera. E.g. 192.168.1.5
PACKAGE_NAME
is the name of the package that you want to remove. E.g. clock
Example: http://127.0.0.1:52520/local/camscripter/package/remove.cgi?package_name=clock
List all installed packages
http://IPADDR[:PORT]/local/camscripter/package/list.cgi
where
IPADDR[:PORT]
is an IP address:port of the camera. E.g. 192.168.1.5
Response example of list action in JSON format:
[{ "package_name": "doorController", "package_menu_name": "Door Controller", "package_version": "1.1.1", "vendor": "Camstreamer s.r.o.", "required_camscripter_version": "1.2.3", "ui_link": "/local/camscripter/package/doorController/index.html" }, { "package_name": "clockAnalog", "package_menu_name": "Analog Clock", "package_version": "1.0.1", "vendor": "Camstreamer s.r.o.", "required_camscripter_version": "1.2.3", "ui_link": "/local/camscripter/package/clockAnalog/index.html" }]
Set or get settings for application
This is usually used from package UI. Settings should be in JSON format. JSON is stored in /package_name/localData/settings.json and is preserved while the package upgrades. SIGINT signal is sent to package if new settings are made.
http://IPADDR[:PORT]/local/camscripter/package/settings.cgi
where
IPADDR[:PORT]
is an IP address:port of the camera. E.g. 192.168.1.5
Parameters:
PACKAGE_NAME
is name of package.ACTION
specify action ( set / get ).
HTTP Proxy
Use the HTTP proxy if the package needs an API. CamScripter App forwards any http(s) request coming to the default HTTP server on the camera as http(s)://IPADDR[:PORT]/local/camscripter/proxy/PACKAGE_NAME/* to http(s)://127.0.0.1:PORT2/* The PORT2 is a unique number defined as an environment variable. The default HTTP server on the camera requires HTTP authorization (basic or digest).
where
IPADDR[:PORT]
is an IP address:port of the camera. E.g. 192.168.1.5
PACKAGE_NAME
is the name of the package. E.g. clock
Redirected to package http port.
http://IPADDR[:PORT]/local/camscripter/proxy/PACKAGE_NAME/*
Example:
http://192.168.1.5/local/camscripter/proxy/clock/test.cgi
Redirected to package http public port.
http://IPADDR[:PORT]/local/camscripter/proxy_public/PACKAGE_NAME/*
/proxy.cgi
Any HTTP(S) request is forwarded to the target camera. You can use it for any VAPIX command.
The proxy implementation allows you to have a fully functional user interface even if you access the camera of the device with the script from a non-local IP address. |
HTTP command:
http://IPADDR[:PORT]/local/camscripter/proxy.cgi
whereIPADDR[:PORT]
is an IP address:port of the camera. E.g. 192.168.1.5:80
Headers of the HTTP command:
- x-target-camera-protocol - target camera protocol:
http
/https
/https_insecure
- x-target-camera-ip - target camera IP address
- x-target-camera-port- target camera port
- x-target-camera-path - target camera path
- x-target-camera-user - target camera username
- x-target-camera-pass - target camera password
Example:
HTTP VAPIX request for view areas on set camera.
http://IPADDR[:PORT]/axis-cgi/param.cgi?action=list&group=root.Image
Access to static html
Access to path /package_name/html/
http://IPADDR[:PORT]/local/camscripter/package/PACKAGE_NAME/*
where
IPADDR[:PORT]
is an IP address:port of the camera. E.g. 192.168.1.5
PACKAGE_NAME
is the name of the package. E.g. clock
Search for cameras on the local network
With this endpoint, you can scan the local network, display the available cameras to the user, and let the user select a camera via the user interface and automatically fill in the desired IP address. The solution uses mDNS protocol and mDNS camera names.
/network_camera_list.cgi
Response:
{
"camera_list": [{
"name": "AXIS A8207-VE - ACCC8EBFD3E5",
"ip": "192.168.91.211"
}, {
"name": "AXIS Demographic Identifier - AXIS Q3515 - ACCC8EBE6D6F",
"ip": "192.168.91.208"
}]
}