Want to use Postman to do API testing? Then this blog on how to automate and load test your API with Postman is for you. Let's get started!
The Loadbalancer.org IP address used in the following examples is: 192.168.5.100. Replace this with your own appliance’s IP address.
Appliance Security Options
Before we can connect to the loadbalancer appliance using SSH, we first need to allow this action through the Appliance Security Options via Local Configuration and then, Security.
Here, you will need to change Appliance Security Mode to Custom. This will then reveal additional security options.
Un-check the Disable SSH Password Access options, as per the example below, then Update:
Connect to the load balancer appliance using ssh with the root user (assuming that 192.168.5.100 is the appliance IP address being used in this example):
Enter your password for the root user when prompted.
Once connected, from the terminal prompt, enable API access with the following command (we’ll keep the user and password credentials the same):
lbcli --action api --function enable --username loadbalancer --password loadbalancer
This should output something similar to the following:
LBCLI API Credentials have been set as
The provided apikey will need to be encoded further into base64 before the key will work with the api calls. If echo is being used with | base64 please remember to use the -n parameter as this will suppress the newline that is normally added at the end of the echo output.
echo -n bHCRj8XzIYsL9nVDKgwyeqONvQfFUx3B | base64
If the -n parameter is omitted then the result is completely different, for example:
echo bHCRj8XzIYsL9nVDKgwyeqONvQfFUx3B | base64
NOTE: If the apikey is wrong, then there is no feedback returned. A response code of 200 only indicates the post was successful, but this is no indication that the post was successful once it reaches the API interface.
Test the connection using curl via the terminal
Before using Postman, let’s test the API via the command line. Use:
NOTE: Ensure the apikey has already been encoded using base64.
JSON payloads form the essential info in the data block for you to send/receive from the server when making API requests. To define the payload, open the Body tab and set the body to Raw and the payload type to JSON.
Copy and paste the JSON payload into the body field. After this, click on Send to submit the payload.
The following JSON payload will return the list of defined DNS entries within the load balancer: