Monitoring, Management & Location Tracking

Accessing the Airwave XML API using curl

Introduction : One of the first steps to using the Airwave XML API is accessing the data using an easily scriptable method. This article will explain how to obtain data from the Airwave XML API using the curl program. You can also apply this method to use wget or other utilities to access the Airwave XML API but it will require some minor syntax changes.


Answer : To access the Airwave XML API pages you must first establish a session and obtain a cookie. This can be done using a combination of the "cookie jar" (-c) and "data" (-d) arguments within curl.

Note that the "-k" flag is also specified. This will ignore any certificate warnings and is an optional flag if you are experiencing issues with self-signed certificate warnings.

Example session command:

# curl -k -c /tmp/cjar -d "credential_0=admin" -d "credential_1=admin" -d "destination=/" -d "login=Log In"

This command will attempt to post credential_0=admin, credential_1=admin to the LOGIN page on the server and save the resulting cookie to the /tmp/cjar file.

Note that credential_0 should be set to equal your username, and credential_1 should be set to equal your password.

Example contents of /tmp/cjar file:

# Netscape HTTP Cookie File
# This file was generated by libcurl! Edit at your own risk.

Our client is now "logged in" to the server as we have a session cookie to use with the next command.

Now the "-b" argument is used to specify a cookie jar to use with our request, in this case /tmp/cjar. Also the --output argument is specified with a parameter of /tmp/ap_detail.xml which is where the output from the command will be saved.

Example API query command:

# curl -k -b /tmp/cjar --output /tmp/ap_detail.xml

At this point a successful query to the Airwave XML API has been made using curl with the output saved to /tmp/ap_detail.xml for further processing. Simply alter the final command's destination from ( to ( for making more complex queries. Detailed instructions are in the Airwave XML API guide found in the Airwave User Guide which can be downloaded from


Verification :

Below is an example showing the ap_detail.xml page being accessed with curl.

[root@localhost mercury]# curl -q -k -c /tmp/cjar -d "credential_0=admin" -d "credential_1=admin" -d "destination=/" -d "login=Log In"
<title>302 Found</title>
<p>The document has moved <a href="/">here</a>.</p>
<address>Apache Server at localhost.localdomain Port 80</address>
[root@localhost mercury]# cat /tmp/cjar
# Netscape HTTP Cookie File
# This file was generated by libcurl! Edit at your own risk.
[root@localhost mercury]# curl -k -b /tmp/cjar --output /tmp/ap_detail.xml
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 88199  100 88199    0     0   104k      0 --:--:-- --:--:-- --:--:--  112k
[root@localhost mercury]# cat /tmp/ap_detail.xml
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<amp:amp_ap_detail version="1" xmlns:amp="" xmlns:xsi="" xsi:schemaLocation=" amp_ap_detail.xsd">
  <ap id="4">
    <ap_group>Access Points</ap_group>
    <interface id="12">
..output truncated...


Version History
Revision #:
1 of 1
Last update:
‎07-17-2014 07:12 AM
Updated by:
Labels (1)
Search Airheads
Showing results for 
Search instead for 
Did you mean: 
Is this a frequent problem?

Request an official Aruba knowledge base article to be written by our experts.