In the previous post, we talk about how to create a REST API using TIBCO BusinessWorks 5.x and the REST and JSON plug-in. If you missed that post you can take a look at it. In this post we create an REST API and use it a WADL file to define and to create the request in the SOAP UI.
But, this is not the only way to do it. The WADL file always have been an artifact not so used in the REST world. Normally, when you try to it to document a REST service you don’t use a WADL file. In the previous days, you use a formal document or web page to explain the call you have to do, the parameters and so on. That’s the way, for example, Amazon or IMDB did with their REST API, but almost nobody was using the WADL file.
To cover this gap, a few years ago, we have another alternative call Swagger. If you take a look at the Swagger official website, you have this description:
Swagger is a simple yet powerful representation of your RESTful API. With the largest ecosystem of API tooling on the planet, thousands of developers are supporting Swagger in almost every modern programming language and deployment environment. With a Swagger-enabled API, you get interactive documentation, client SDK generation and discoverability.
And TIBCO BusinessWorks 5.x have SWAGGER compatibility, specifically with the 1.2 version. That’s a pity because the current version is the 2.0 and it brings a lot of new features and it’s now a non-official standard.
To show you how to use SWAGGER in TIBCO BusinessWorks 5.x, we are going to use the code from the last post, and we are going to click the “Export Swagger” button in the “REST Dispatch and Reply”, as you can see here:
And after we complete the pop-up dialog we are going to have a ZIP file. That ZIP file is a web service with a web page with the “documentation” of our API. So if we unzip the file and we have the follow structure:
So, we only have to run the startup.bat (or .sh if we are in a UNIX based environment), and if we access the endpoint we have a web page like this:
So, you have all the definition of the REST API and even we can test it from this webpage. I hope you can use this information for your current and future developments!!