The BB-400 provides a REST server implementation that can be used to receive and modify information. This FAQ will explain how POSTMAN, a REST API client can be used to access and change information regarding the IO line status on the BB-400.
POSTMAN is one of a number of softwares used for API testing and development. The POSTMAN application is free to download for individuals and small teams.
Install the POSTMAN application
To see the status of the IO lines we can select the option to create a new GET request. GET requests allow the user to retrieve information without modifying the original information, even if the requests are sent multiple times.
To GET the current IO status of the BB-400, enter the IP address of the BB-400 followed by a colon ( : ), the port number the REST API server is running on (which in our case is 9000), as well as appending the path "/io" and click on Send. The POSTMAN application will retrieve or GET the IO status from the BB-400:
The following examples show that by choosing the appropriate path, one can filter the relevant information to obtain or GET information regarding the IO lines.
1. To get the input states of the IO lines
2. To get the input state of a selected IO line
3. To get the output states of the IO lines
4. To get the output state of a selected IO line
Next we might want to change the output values of the BB-400 IO lines. A POST request allows the user to modify the original information.
To configure the POSTMAN application to send POST commands, change the request from GET to POST.
Then, underneath "Body", the "raw" option should be selected and the input type should be changed to JSON (application/json).
Now, the POST requests can be entered in the Body section and clicking the Send button will send the POST request.
After sending the POST requests, it is possible to see the change in IO output values reflected in the LED state on the front of the BB-400 device and via the status or IO pages of the BB-400's web based interface. If the POST request is successful a "200 OK" status will be returned, otherwise an unsuccessful status code will appear.
1. To set the output states of the IO lines
To set the output states of all the IO lines, the data should be set as a JSON array:
The web admin IO page shows that the POST request closed all the outputs:
2. To set the output state of a selected IO line
To set the output state of an individual IO line, first change the path to the line required, then send a POST command:
The web admin IO page can also be checked:
This FAQ has described how POSTMAN, a REST API can be used to receive and modify the status of the IO lines. A few examples of how to use the GET and POST commands have been provided to show the user how the REST server implementation works using the BB-400 IO line status.