This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.

Add API Documentation using Swagger

Create the API definition

  1. Log in to the API Publisher.
  2. Click the API to which you want to add documentation to (e.g., PhoneVerification 1.0.0).
  3. Go to the Doc tab of the API and click the Edit Content link associated with its Swagger definition.

  4. The API's Swagger definition opens. Modify the definition according to your requirements.
    For example, the PhoneVerification API's internal implementation requires two parameters to invoke it: a telephone number and a license key. We can document this by editing the description of the GET method in the API definition as "Give the telephone number and the license key. For example, PhoneNumber=18006785432&LicenseKey=0". Also change the summary as "Validate your phone number".

  5. Once you are done editing the definition, click Save and Close.

View the interactive documentation

  1. Log in to the API Store and click the PhoneVerification 1.0.0 API.
  2. The API's Overview page opens. Go to the API Console tab, which shows the interactive documentation of the API.

    Tip: The HTTP methods that are listed here vary depending on the ones you added at the time the API is created.

  3. Note the modifications you did to the API definition. For example, expand the GET method and see its description mentioning to the user to provide two parameters to invoke the API.

You have created interactive documentation using Swagger and seen how the documentation is reflected in the Swagger API console.