Sample Swagger JSON File

A sample Swagger.json file of the BookStore example is available in <TIBCO_HOME>/amx/3.4/samples/rest/samples/bookstore/.

An overview of the fields from the sample Swagger.json file is provided below. For a complete list of all the objects and fields that can be defined in the swagger.json file, refer to https://github.com/OAI/OpenAPI-Specification/.

Field Name Description
swagger Specifies the Swagger Specification version being used. For example:
"swagger" : "2.0"
info Provides metadata about the API. For example, the Application API version, title, and port type of service.
"info" : 
{"version" : "1.0", 
"title":"com.tibco.restbt.sample.bookstore", 
"description" : 
"Port Type:BookStoreResource"}
basePath The base URL of the server. All API endpoints are relative to the base URL. The base URL is of the following format:
scheme://host[:port][/path][parameters]

Some examples are:

http://localhost:8080/bookstore/books
http://localhost:8080/bookstore/books/{title} (with path parameters)
http://localhost:8080/bookstore/books?storename=demo (with query parameters)
host The Host of the Service. For example:
"host" : "localhost:9009"
schemes The type of the security scheme supported for authentication. For example:
"schemes" : [ "http" ]
paths

The relative paths to the individual endpoints and their operations. The path is appended to the base URL to construct the full URL.

tags A list of tags applicable for the operation. Tags can be used for logical grouping of operations. For example:
 "tags" : ["BookStoreResource"]
description
An explanation of the operation.
 "description" : "getBookList"
operationId Unique string used to identify the operation. For example:
"operationId" : "getBookList"
produces A list of MIME types the operation can produce. For example:
"produces" : [ "application/json", "application/bjson",
"application/xml" ]
consumes A list of MIME types the operation can consume. For example:
"consumes" : [ "application/json", "application/bjson",
"application/xml" ]
parameters A list of parameters that are applicable for the operation. For example:
"parameters" : [ {
          "name" : "storename",
          "description" : "getBookListRequest",
          "schema" : {
            "description" : "getBookList",
            "type" : "string"
          },
          "in" : "query"
        } ]
responses A list of possible responses returned by executing the operation. For example, a successful response is:
"responses" : {
          "200" : {
            "description" : "Successful Response",
            "schema" : {
              "$ref" : "#/definitions/getBookListResponse"
            }
          }
        }
$ref

Refer to other components in the specification, internally and externally.

For example:
"$ref" : "#/definitions/getBookListResponse"