This article is an introduction to the AXIS API and how to use it. Here, you can grasp how it works and then use the official Axis VAPIX library to write your code.
What is VAPIX
If you are a software developer, you probably know what an API is, right?
I'm assuming you know the basics of programming and API so you are here just to understand how to use VAPIX so you can use it to make devices to communicate.
Alright, so here's the definition.
VAPIX® is an open API (Application Programming Interface) developed by Axis Communications using standard protocols to integrate the communication between different devices and platforms and automate tasks.
With this API, it's possible to use a variety of features such as:
This is only a basic list of things you can do using VAPIX.
The available VAPIX API
Here's a list of the VAPIX APIs.
- HTTP and HTTPs GET/POST
- HTTP and HTTPs POST JSON
- SOAP (Web Services)
As a developer, you can use the best method that works for you.
The "HTTP/HTTPS GET" is the most frequently used by Axis customers.
How to have access to the VAPIX Library
To access the Axis VAPIX library, you need to visit the official Axis website and create an account; then, you can use it to log in to the portal.
Create an Axis account
Visit the Axis Website and click "Login" on the top right side of the page.
Click "Register new account" and follow the steps.
Login to the VAPIX portal
Once you have created your account, visit the Axis VAPIX library.
Enter your username and password to login in.
And now you have access to everything you need to write your code 🙂
Examples of the VAPIX Library
Let's look at some examples of the commands.
Here's a real one with my Axis P1365 MK II camera.
Basic VAPIX command
I want to know what resolution the camera is using....
Here's the command (typed into a web browser).
The command is executed as long as you are logged in to the camera with administrator privileges (root). The browser returns the result of the operation.
Let's brake down the command.
As you can see, the VAPIX is easy to understand. You just need to read the documentation available in the official Axis website to get what you want.
Command using the "&" symbol
It's possible to use the "&" symbol to concatenate more arguments.
Here's an example of a VAPIX command using the "&" signal.
And here's what the camera returns...
As you can see, I'm using the param.cgi command (application) to list the camera parameters and then concatenating (&) the group argument to filter the results.
If the group argument is NOT used, the command lists all the parameters...
Sometimes the web browser can't handle the command because of the spaces, or special characters that are not supported. In this case you can use HTTP encoding.
There's a universal standard RFC 3986 that lists the HTTP Encoding.
Here's a quick table that is useful for Axis VAPIX.
Let's take a look at an example...
Example of HTTP encoding
Here's a VAPIX command to close the camera I/O for port 1.
As you can see, I'm using the Axis-cgi/io path and the port.cgi command (application).
After the argument there's the port number (1) and the symbol to activate (/) the port.
The web interface does NOT return any information, so you have to took at the camera.
You can use the same command with the HTP Encoding. Take a loot at this one...
The picture below shows the LED ON after the command...
And then, it's possible to use the same command with the symbol (\) to deactivate the port.
As an alternative (using HTTP encoding)
Either way, you can have the camera responding to the VAPIX command.
The HTTP encoding is safer because it works with different browsers.
VAPIX command examples
- List the camera parameters.
- List the camera I/O parameters.
- List the camera application (ACAP) available in the camera
Example of PTZ VAPIX commands
- List the available presets in the camera
- Execute a preset in the camera to send it to a specific position (Name).
- Execute a preset in the camera to send it to a specific position (Number).
- Set the "Return to home when inactive" time to 30s
- Start the PTZ Guard Tour
- Enable the camera Wiper (models Q8665, AXIS Q8686 and AXIS Q87x)
- Disable the camera Wiper (models Q8665, AXIS Q8686 and AXIS Q87x)
Example of VAPIX commands for user management
- Create a new user "user1" with password "myPass" as part of the group "users" with "viewer" privileges and insert a comment "NewUser".
Example of VAPIX commands for audio
- Play audio clip (For Axis Speakers)
Example of VAPIX commands for ACAP
- Start the Video Motion Detection (VMD) ACAP.
- Stop the Video Motion Detection (VMD) ACAP.
- Check the camera architectural platform before installing ACAP.
The camera returns a result such as: "Properties.System.Architecture=mips"
Example of VAPIX commands for troubleshooting
- Use the ping command to test the communication in the network
You should see the text "got response" if the ping is successful.
- Extract a server report from the camera
- Get a Wireshark trace from the camera for one minute.
VAPIX is a powerful API that allows you to use command to request information, control, update, manage and automate Axis devices.
In this article, you've learned the basic of this API but you can learn much more in the official Axis Website.
Please share this article with your friends.
Claudemir Martins is a former Samsung Engineer with 19+ years of experience in the surveillance industry. He has been traveling around 17 different countries to teach people how to design, and install CCTV systems. He is currently working for Axis Communications as a Technical Services Engineer and living in the United States with his family.