Copyright © TIBCO Software Inc. All Rights Reserved
Copyright © TIBCO Software Inc. All Rights Reserved


Chapter 7 Managing RESTful Web Services : Exporting RESTful Web Service to Swagger

Exporting RESTful Web Service to Swagger
TIBCO ActiveMatrix BusinessWorks Plug-in for REST and JSON supports exporting the RESTful web services to Swagger version 2.0.
To Export the RESTful web services to Swagger, complete the following steps:
1.
Create a RESTful web services in the REST Dispatch and Reply activity. See Creating a RESTful Web Service for details about how to create a RESTful web service.
2.
Click the REST Dispatch and Reply activity in the process.
3.
In the Service Editor tab, click Export Swagger. The Export Swagger dialog is displayed as shown in Figure 11.
Figure 11 Export Swagger Dialog
 
4.
See Export Swagger Button for details about the exporting format.
5.
In the REST API Host field, enter the REST API host where Swagger can send HTTP request to. For example, http://localhost:8089.
6.
If you select the ZIP format, Enter the Swagger server port in the Swagger Server Port field. The default value is 9999.
Note: You can also update the server port by updating the winstone.properties file which is located in the api-docs directory after you export the Swagger file.
7.
In the Export Dir field, specify a directory where the file is exported to.
8.
9.
10.
11.
12.
If you want to customize the Swagger web page, select the Show Advanced check box and configure the corresponding fields. See Export Swagger Button for details.
13.
Click OK to save the configuration.
Starting a Swagger Server
After exporting the RESTful web service to Swagger, you can start a Swagger server.
The way to start a Swagger server varies depending on the exported format. If you want to use your own server instead of the default Winstone, deploy the WAR file to a J2EE container. If you use Winstone to start a Swagger server, complete the following steps:
1.
2.
Run the startup file on the command line to start the Swagger server.
Testing a RESTful Web Service in Swagger
After you start the Swagger server, complete the following steps to test RESTful web services in Swagger:
1.
http://host:swaggerServerPort/swagger.ui
A Swagger Web UI is displayed as shown in Figure 12.
Figure 12 Swagger Web UI
 
Show/Hide: Click to show or hide the APIs on the page.
List Operations: Click to list all the operations of APIs.
Expand Operations: Click to expand all the operations of APIs.
2.
Figure 13 Expanding the API
3.
Enter the required parameters, and then click Try it out to test the API as shown in Figure 14.
Figure 14 Entering the Parameters
Figure 15 shows the results and whether the API is useful.
Figure 15 Checking the Results
 
 

Copyright © TIBCO Software Inc. All Rights Reserved
Copyright © TIBCO Software Inc. All Rights Reserved