Snapt Aria: API Beginners Guide
  • 14 Jan 2022
  • 4 Minutes to read
  • Dark

Snapt Aria: API Beginners Guide

  • Dark

The Snapt Aria API is an XMLRPC API to all of the Snapt Aria modules and functions. You can retrieve statistics, issue commands, change configurations and much more with the correct use of the API. For detailed commands for the various Snapt Aria modules please go to their specific sections.


In order to use the Snapt Aria API, you must install the Snapt Aria API plugin (freely available) via the Plugin system on the server. You can then go to the Setup -> API menu in order to receive your API Key and Secret Key for interacting with the API. These keys will be required in every API command to authenticate you.

Starting Out

We advise you select either the PHP, Ruby or Python example code library to build on top of. These are available on the Code page.

Sending Commands

The Snapt Aria API works on a per-module basis. The module you want to interact with may be the Snapt Aria virtual Load Balancer or Website Accelerator, or others. You must indicate this on the URL string, as well as in your command.

For example, this is the URL we send an XMLRPC request to in order to speak to the Load Balancer:


This string is made up of 4 parts. The first is the URL to the API: http://snapt:8080/api/. The second is the API Key given to you, and the third is the API secret given to you. The final part (snaptHA) is the module. These are the module names for the available APIs:

  • Load Balancer: snaptHA
  • Web Accelerator: snaptNginx
  • Web Application Firewall: snaptWAF
  • Cache: snaptSquid
  • Backup: snaptBackup
  • GSLB: snaptGSLB
  • Redundancy: snaptRed

There are several framework APIs available as well:

  • Operating System: os
  • Activity Log: act
  • Notices: notices

Your First Command

For our first command, we will request a list of the methods available in the “os” class. In order to do that we use the built-in request “system.listMethods” which is available in every module.

import xmlrpclib proxy = xmlrpclib.ServerProxy("http://localhost:8080/api/key/secret/os"); print(str(proxy.system.listMethods()));

As you can see we are referencing the os API, and sending system.listMethods() in Python. This returns the following:

['system.listMethods', 'system.methodHelp', 'system.methodSignature', 'system.multicall', 'os.getInterfaces', 'os.getIPs', 'os.getDiskUsage', 'os.getLoadAverages', 'os.getMemoryUsage', 'os.getProgramMemoryUsage', 'os.getProgramCPUUsage', 'os.getCPUUsage', 'os.getOs', '', '', 'os.dmesg', 'os.uname', 'os.writeSysctls']

Let us try the os.getIPs request, to receive a list of the IP addresses on the server.


Here you can see we have changed our request to os.getIPs(). This could be any of the commands above. It returns the following information for us:

{'1': '', '0': '', '2': ''}

And that is how you send a command and receive information – congratulations! You can use the system.listMethods command to explode and discover commands as well. As you can see, getCPUUsage would return CPU Usage and so on.

Advanced Commands

As your API usage grows you will need to send information as well – parameters for your request. These are passed as parameters to your calls. Below you will see an example of sending a “stat” request to socketGet in the Load Balancer. This returns us a dump of the live stats from the Load Balancer socket:

import xmlrpclib proxy = xmlrpclib.ServerProxy("http://localhost:8080/api/595-1eec-13f3-12fb/SNP54eda0bb8ec48324035047/snaptHA"); print(str(proxy.snaptHA.socketGet("stat")));

The results look like so:

{'Web-HTTP': {'web0': {'status': 'UP', 'lastchg': '5251', 'weight': '10', 'slim': '', 'pid': '1', 'econ': '0', 'wredis': '0', 'dresp': '0', 'ereq': '', 'tracked': '', 'pxname': 'Web-HTTP', 'dreq': '', 'sid': '1', 'bout': '0', 'qlimit': '', 'bin': '0', 'smax': '0', 'lbtot': '0', 'stot': '0', 'wretr': '0', 'iid': '2', 'chkfail': '0', 'downtime': '0', 'qcur': '0', 'eresp': '0', 'throttle': '', 'scur': '0', 'type': '2', 'bck': '0', 'qmax': '0', 'act': '1', 'chkdown': '0', 'svname': 'web0'}, 'FRONTEND': {'status': 'OPEN', 'lastchg': '', 'weight': '', 'slim': '50000', 'pid': '1', 'econ': '', 'wredis': '', 'dresp': '0', 'ereq': '0', 'tracked': '', 'pxname': 'Web-HTTP', 'dreq': '0', 'sid': '0', 'bout': '0', 'qlimit': '', 'bin': '0', 'smax': '0', 'lbtot': '', 'stot': '0', 'wretr': '', 'iid': '2', 'chkfail': '', 'downtime': '', 'qcur': '', 'eresp': '', 'throttle': '', 'scur': '0', 'type': '0', 'bck': '', 'qmax': '', 'act': '', 'chkdown': '', 'svname': 'FRONTEND'}, 'BACKEND': {'status': 'UP', 'lastchg': '5251', 'weight': '10', 'slim': '5000', 'pid': '1', 'econ': '0', 'wredis': '0', 'dresp': '0', 'ereq': '', 'tracked': '', 'pxname': 'Web-HTTP', 'dreq': '0', 'sid': '0', 'bout': '0', 'qlimit': '', 'bin': '0', 'smax': '0', 'lbtot': '0', 'stot': '0', 'wretr': '0', 'iid': '2', 'chkfail': '', 'downtime': '0', 'qcur': '0', 'eresp': '0', 'throttle': '', 'scur': '0', 'type': '1', 'bck': '0', 'qmax': '0', 'act': '1', 'chkdown': '0', 'svname': 'BACKEND'}}}

If we were to change that to “info” instead of “stat” we would receive this:

{'SslFrontendSessionReuse_pct': '0', 'Uptime': '2d 23h12m51s', 'Release_date': '2019/02/06', 'Stopping': '0', 'Run_queue': '1', 'Process_num': '1', 'Version': '1.9.4', 'CumConns': '868', 'MaxSessRate': '0', 'Uptime_sec': '256371', 'PoolAlloc_MB': '0', 'ConnectedPeers': '0', 'BusyPolling': '0', 'SslBackendKeyRate': '0', 'Jobs': '3', 'SessRate': '0', 'MaxSslRate': '0', 'SslCacheMisses': '0', 'CompressBpsRateLim': '0', 'ActivePeers': '0', 'Ulimit-n': '4040', 'CurrConns': '0', 'Nbproc': '1', 'ConnRateLimit': '0', 'CumSslConns': '0', 'MaxZlibMemUsage': '0', 'SslRate': '0', 'SessRateLimit': '0', 'DroppedLogs': '0', 'node': 'snapt-master', 'Memmax_MB': '0', 'CurrSslConns': '0', 'SslRateLimit': '0', 'Name': 'HAProxy', 'MaxSslConns': '0', 'ZlibMemUsage': '0', 'SslFrontendMaxKeyRate': '0', 'ConnRate': '0', 'CompressBpsOut': '0', 'Listeners': '2', 'SslCacheLookups': '0', 'PipesFree': '0', 'Maxsock': '4040', 'Hard_maxconn': '2000', 'PoolFailed': '0', 'Tasks': '4', 'PoolUsed_MB': '0', 'Maxpipes': '0', 'MaxConnRate': '0', 'SslFrontendKeyRate': '0', 'Pid': '1777', 'Nbthread': '1', 'PipesUsed': '0', 'Unstoppable Jobs': '0', 'CompressBpsIn': '0', 'Maxconn': '2000', 'CumReq': '868', 'Idle_pct': '100', 'SslBackendMaxKeyRate': '0'}