API Documentation

CamScripter App 1.x API

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.


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 Proxy
HTTP_PORT_PUBLIC proxy without authorization. See chapter HTTP Proxy
INSTALL_PATH
PERSISTENT_DATA_PATH folder which is suitable for permanent data. All data survive restart of the camera or package upgrade
PACKAGE_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. root
PASS is a password . E.g. pass
IPADDR[: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/*



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



Feel free to contact our support in case of any problem.