1. Home
  2. API
  3. API Documentation
  4. Snapt Aria: API Beginners Guide

Snapt Aria: API Beginners Guide

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.

Installation

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:

http://snapt:8080/api/APIKEY/APISECRET/snaptHA
  • 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()));

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")));
Updated on March 19, 2020


Was this article helpful?

Related Articles