Dynamic Configuration With API

XPoint AppScaler has built-in API engine which enables the configuration of an AppScaler device by web service requests through HTTPS protocol.

The APIs can be requested by HTTP request (either GET or POST method). The API client can be anything which could perform HTTP request, for instance:

  • Browser
  • wget
  • curl

 

The default payload format is XML, but it can be changed in runtime by appending JsonFormat=1 to the HTTP request, for instance:
https://{IP}/api?user={user}&token={token}&mod=setup&cmd=getSys&JsonFormat=1

URL Format is as below:
https://{IP}/api?user={user}&token={token}&mod=setup&cmd=getSys&{params}={params}

Some API requires files download/upload and we recommend the curl to perform the API call for any file download/upload.

The example to perform API call with file uploads:

curl -X POST -F “user={user}” \
-F “token={token}” \
-F “mod=setup” \
-F “cmd=regLic” \
-F “licfile=@{licfile}” \
-k https://{IP}/api

The example to perform API call with file downloads:

curl -o genlicfile -X GET –k \
“https://{IP}/api?user={user}&token={token}&mod=setup&cmd=getLicRequest”

 

The example XML output:

<response state=”200″ code=”ok”>

<data>

<vs>

<id>2</id>

<vsname>VS002</vsname>

<vstype>1</vstype>

<vslayer>7</vslayer>

<apptype>http</apptype>

<ip_address>192.168.0.250</ip_address>

<port>80</port>

<forward>1</forward>

<notes>vs ip update</notes>

<enabled>y</enabled>

<stats>y</stats>

<status>Down</status>

</vs>

<vs>

<id>6</id>

<vsname>VS007</vsname>

<vstype>1</vstype>

<vslayer>7</vslayer>

<apptype>http</apptype>

<ip_address>192.168.0.253</ip_address>

<port>80</port>

<forward>1</forward>

<notes/>

<enabled>y</enabled>

<stats>n</stats>

<status>Up</status>

</vs>

<vsgroup>

<id>3</id>

<vsname>VSGroup1</vsname>

<vstype>0</vstype>

<vslayer>7</vslayer>

<apptype>http</apptype>

<ip_address>192.168.0.109</ip_address>

<port>80</port>

<forward>1</forward>

<notes>new vs group</notes>

<enabled>y</enabled>

<stats>y</stats>

<status>Down</status>

</vsgroup>

</data>

</response>

 

The example JSON output:

{

“vs”: {

“0”: {

“id”: “2”,

“vsname”: “VS002”,

“vstype”: “1”,

“vslayer”: “7”,

“apptype”: “http”,

“ip_address”: “192.168.0.250”,

“port”: “80”,

“forward”: “1”,

“notes”: “vs ip update”,

“enabled”: “y”,

“stats”: “y”,

“status”: “Down”

},

“2”: {

“id”: “6”,

“vsname”: “VS007”,

“vstype”: “1”,

“vslayer”: “7”,

“apptype”: “http”,

“ip_address”: “192.168.0.253”,

“port”: “80”,

“forward”: “1”,

“notes”: “”,

“enabled”: “y”,

“stats”: “n”,

“status”: “Up”

}

},

“vsgroup”: {

“1”: {

“id”: “3”,

“vsname”: “VSGroup1”,

“vstype”: “0”,

“vslayer”: “7”,

“apptype”: “http”,

“ip_address”: “192.168.0.109”,

“port”: “80”,

“forward”: “1”,

“notes”: “new vs group”,

“enabled”: “y”,

“stats”: “y”,

“status”: “Down”

}

},

“state”: 200,

“code”: “ok”

}

 

XPoint AppScaler API Engine covers all the configurations from system setup, Server Load Balancing, Global Server Load Balancing and Reports. And there are 370+ API methods available, see the API reference here.