Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Adding interactive documentation

The API Manager provides facility to add interactive documentation support through the integration of Swagger. Swagger is a specification and a complete framework implementation for describing, producing, consuming, and visualizing RESTful Web services. In Swagger, when APIs are described in simple static JSON representation, they can be loaded through the Swagger UI, which in turn provides the interactive documentation.

When an API is created, the JSON representation of that API is automatically generated and saved into the registry as API definition. This definition describes the API with the information provided at the API creation level. You can customize the automatically generated API definition as follows:

  1. Click the Edit link right next to the API's name in the API Publisher.
     
  2.  Click the Edit Swagger Definition button.
  3. When the Swagger definition of the API opens, document the parameters required by the API Console.
    For example, the PhoneVerification API requires a telephone number and a license key. You can document this by adding the following under the parameters section of the GET method:

    Code Block
    parameters:
       - description: Request Body
         name: body
         allowMultiple: false
         required: true
         type: string
         paramType: body
       - description: Give the phone number to be validated
         name: PhoneNumber
         type: string
         required: "True"
         paramType: query
       - description: "Give the license key. If you don't have any, enter 0"
         name: LicenseKey
         type: string
         required: "True"
         paramType: query


    Image Modified

  4. Click Save once the changes are done.

...