FREE ACAP learning resourcesFREE learning materials, ranging from videos and webinars to written articles and selection guides
ACAP development
Overview
The primary user interface in the Axis cameras is a web server hosting a website that allows you to access the camera using a graphical user interface. This is a bit different from creating applications in a normal computer where the graphical user interface is created using the device's own display. This means that the most common way for an ACAP application to interface with a user is by using a web server where it can expose its own website (as we will learn more about later, most ACAPs does however not depend much on their own graphical user interface since they are often background processes in a distributed system).
Creating a website that is linked to from the cameras website makes the ACAP feel like an integral part of the camera and can easily be done using the available features in the ACAP SDK. There are however multiple ways of doing this and through the generations of SDKs, different approaches have been recommended.
Your application can always bundle custom web pages (e.g. HTML, CSS and JavaScript) that will be served by the cameras built in web server. No configuration is needed for this, the only thing you need to do is to create a directory called html in your application directory. When the application is installed, these pages will be served by the cameras built-in web server (Apache) and you can view them by going to the URL http://<CAMERA_IP>/local/<APP_NAME>/<FILE_NAME> in your browser.
Since these pages are static documents they can't access the state of your application and they can't run any code in the camera (only in the browser, like e.g., JavaScript). This makes them a helpful tool, but not a complete solution for creating graphical user interfaces for your applications.
The three most common methods to create graphical user interfaces in your application all share the fact that they configure the cameras built in web server (Apache) to proxy some traffic to the application.
The Legacy Solution
In the early versions of AXIS OS, the supported way to serve dynamic content from the application was to use the axhttp library (an Axis specific library in the SDK). You could then configure endpoints in the manifest file (or earlier, before the manifest file existed, with other config files). These endpoints would generate URLs in the Apache web server that triggered callbacks in your application from the axhttp library.
In the following example of a manifest.json file we can see that one endpoint is registered with the transferCgi method. It is configured to require the admin authorization level.
{
"schemaVersion": "1.1",
"acapPackageConf": {
"setup": {
"friendlyName": "LegacyWeb AxHTTP",
"appName": "LegacyWeb",
"vendor": "FixedIT Consulting AB",
"embeddedSdkVersion": "2.16",
"user": {
"group": "sdk",
"username": "sdk"
},
"vendorUrl": "fixedit.ai",
"runMode": "never",
"version": "0.0.1"
},
"configuration": {
"settingPage": "settings",
"httpConfig": [
{
"access": "admin",
"name": "settings",
"type": "transferCgi"
}
]
}
}
}With this configuration, you can access your API by going to the URL http://<CAMERA_IP>/local/<APP_NAME>/settings in your browser. This configuration can be explained by the following image. The Apache web server and the axhttp library are communicating through a UNIX Domain Socket, but the communication itself is hidden by the Axis axhttp library.

Using fastCgi To Communicate With The Process
A more recent method to make the Apache web server interact with your process is to use the FastCGI Developer's Kit. This is an open source library that has been around for decades, and with the relatively new fastCgi option in the manifest file (added in manifest schema 1.1) you can create dynamic web endpoints without the use of the axhttp library. This works very similar to the transferCgi method with the difference that you are yourself responsible for using the FCGI library to open the UNIX domain socket, something that was handled by the axhttp library before. This might make it slightly more complex but makes it much more flexible, allowing you to do e.g. streaming responses.
The manifest would look the same as in the transferCgi example, but with type specification changed from transferCgi to fastCgi. This can be explained by the following diagram where Apache is talking directly to the ACAP.

Running a Stand-Alone Web Server
The third option is to run a stand-alone web server in your application. This might be a more flexible approach since you are more free to use whatever server you want to. You might e.g. use the monkey web server for C, or the flask web server in Python (if using the Computer Vision SDK 4).
This web server will be available on TCP/IP and bind to another port number than the cameras built-in web server. If you want to make use of the user authentication that already exist in the camera, then you can bind your own web server to the 127.0.0.1 IP which will prevent any external connections. You can then configure the Apache web server to proxy some traffic to your server, but to do so only if the user is authorized.
Previously this was manually configured by installing a new Apache config file in the /etc directory, but starting from SDK 4.12 and manifest schema 1.5.0, this can also be configured in the manifest.json file. This can also be seen in Axis' official examples repo.
{
"schemaVersion": "1.5.0",
"acapPackageConf": {
"setup": {
"appName": "list",
"vendor": "Axis Communications",
"embeddedSdkVersion": "3.0",
"runMode": "never",
"version": "1.0.0"
},
"configuration": {
"reverseProxy": [
{
"apiPath": "my_web_server",
"target": "http://localhost:2001",
"access": "admin"
}
]
}
}
}With this configuration, you can access your API by going to the URL http://<CAMERA_IP>/local/<APP_NAME>/my_web_server in your browser. This method can be explained by the following image where we can see that all the users traffic goes to the Apache web server, but the traffic to the application is proxied by Apache to the other web server on another port. The static HTML files can be served either by the stand-alone web server or by the Apache web server.

There are multiple options and no option is a one-size-fits-all. One important consideration is which versions of AXIS OS you need to support (and therefore, which camera models you need to support). If you are only targeting the latest firmware, then you are free to chose either of the three, but:
If you need to support many versions of AXIS OS, you should consider:
Dealing with multiple variants of the ACAP is complicated from two perspectives:
At FixedIT, we have created a backported support module for the fastCgi method that allows us to use the same implementation of the server in all AXIS OS versions, ranging from 9.80 (2020 LTS) to the latest.
In this lesson we have seen how many different options there are for creating websites in the application. We have seen that they all have their pros and cons (that's why they are all supported) and that selecting the right one for you can have severe implications on usability and operations. This lesson should have helped you with the information needed to make a more educated decision.