Swagger UI
The Swagger UI is an open source project to visually render documentation for a Swagger-defined API, directly from the API's Swagger specification. Currently, it uses Swagger specification version 2.0 and Application API version 1.0.
REST Service Binding samples are available in
<TIBCO_HOME>/amx/<version>/samples/rest/samples/
. This section uses the
bookstore
sample to provide an overview of the Swagger UI.
The
bookstore
sample illustrates how a bookstore administrator can look up a books inventory and add new books. The administrator can look up books by a specific title or get a list of all books.
The following information is displayed on the Swagger UI.
- Base URL: Each server has a base URL that has the following format. All API endpoints are relative to the base URL.
scheme://host[:port][/path][parameters]
For example:
http://localhost:8080/bookstore/books
Where
localhost
is the host8080
is the port to access the host- http://localhost:8080/bookstore is the base URL
/books
is the endpoint path
The following is an example with path parameters:
http://localhost:8080/bookstore/books/{title}
Where
{title}
is the path parameter and you must provide the parameter value when making an API call.The following in an example with query parameters:
http://localhost:8080/bookstore/books?storename=demo
Where?storename=demo
are the query parameters. - Port Type: Port type of Service.
- Schemes: Security schemes used to execute the operations.
-
Operations: Displays a list of all the operations that are implemented by the REST Service on each Endpoint. Operations are HTTP methods (example: GET, POST, DELETE) used to access the Base URL. These operations are configured in TIBCO Business Studio - BPM Edition. The corresponding schema and parameters are configured in the WSDL file.
From this section, you can invoke an operation and receive a live Response for the specific inputs.
- Models: Displays the schema in detail in the JSON format. It shows how data in the WSDL and XSD is configured.
The schema for the BookStore example is shown below.