How to use the bwagent REST API in BusinessWorks
This article is to explain how to use the bwagent REST API in BusinessWorks 6.X.
It is important to secure the bwagent REST API and this is explained in this other article:
https://medium.com/@emarchiset/how-to-secure-the-bwagent-rest-api-8632ad7d7b8e
API documentation
The API is documented in the form of an interactive Swagger UI.
The Swagger UI can be used with the following:
# Start the bwagent with the apiserver option
. Note that this can be done even if the ‘real’ bwagent is running on the server
. go to the <TIBCO_HOME>/bw/6.X/bin directory
. Launch the bwagent with the ‘apiserver’ option, like this
./bwagent apiserver (Linux)
bwagent apiserver (Windows)
# Navigate to the Swagger page
. By default it is available on the 5555 port
http://localhost:5555/index.html
Using the API
The swagger UI doesn’t allow to directly use the API but it provide all details needed to call the API.
For example in the Swagger UI it is possible to get details on the /browse/appnodes method and to try it:
Note that the methods are not really called from the Swagger UI, but in the results section you get the URL to use to call this method:
This URL then need to be updated to be able to call the ‘real’ API exposed by the bwagent:
. The /api part should be replaced by /bw/v1/
. The hostname refer to the host where the target bwagent is running
. By default bwagents expose the REST API on the 8079 port
So to call the /browse/appnodes method on my ‘TESTEM’ domain I have to use the following URL:
GET http://localhost:8079/bw/v1/browse/appnodes?domain=TESTEM
Then this URL can be used in a tool like Postman:
Note that the bwagent port used to expose the REST API can be configured by adjusting the following property in the bwagent.ini file:
bw.agent.http.port
Reference elements