JSON-based Input and Output for the LoadMaster RESTful API

In LoadMaster firmware version 7.2.50, beta functionality was added which allows you to specify API requests as a POST of a JSON object and receive a JSON-based API payload response. As of firmware version 7.2.52, this functionality is no longer in beta and is officially part of the LoadMaster product.

Certificate-based authentication is not supported when using JSON-based input and output. The old format of the API supports certificate-based login in addition to basic authentication. However, certificate-based login has proved to be relatively difficult and costly for customers to configure and maintain. Customers have requested a token-based method of remote login - so API keys have been introduced. For further details, refer to the How to Use API Keys section of the RESTful API Interface Description document.

To use JSON-based input and output, all requests must be a POST of a JSON object. For authorization purposes, an API key (apikey) or a username/password pair (apiuser, apipass) can also be given. Once the machine has been licensed, one or the other must be provided for access to be allowed. If an apikey is provided, this has precedence over any username/passwords provided.

Each request is a JSON object. The only mandatory field is cmd which is the name of the command to execute.

Some commands have sub-commands, for example logging, ssodomain, aclcontrol, geoacl, and cluster. In the old format, most of these sub-commands are run like this: <LoadMasterIPAddress>/access/logging/df. In the new format, here is an example of how a sub-command is run: logging.df.

Here is an example of a simple request (-d tells cURL to send the following string as a POST request):

curl -k -d '{ "apikey" : "<APIKey>", "cmd" : "listapi" } ' https://<LoadMasterIPAddress>/accessv2

Here is another example that sets a parameter value:

curl -k -d '{ "apikey" : "<APIKey>", "cmd" : "set", "param" : "enableapi", "val" : true } ' https://<LoadMasterIPAddress>/accessv2

For reference, here is how these requests would look if you ran theas API v1 commands using the old format:

https://<LoadMasterIPAddress>/access/listapi

 

https://<LoadMasterIPAddress>/access/set?param=enable&value=1

Any parameters given to the accessv2 request are ignored. For example, <LoadMasterIPAddress>/accessv2/example is the same as <LoadMasterIPAddress>/accessv2.

If a command requires binary data, for example a certificate, this data must be passed in the "data" string and be base64-encoded.

If a command returns binary data, this is returned as a base64-encoded string. This field normally has the name "data".

For details of all RESTful API commands and parameters, refer to the Long Term Support (LTS) RESTful API Interface Description document.

Was this article helpful?

0 out of 0 found this helpful

Comments