This documentation is for WSO2 Enterprise Integrator version 6.1.1 . View documentation for the latest release in the 6.x.x family and the latest release in the 7.x.x family.

All docs This doc

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Update to a step under generating the swagger docs.

...

Tip

You need to have created a REST API to view the documentation for that API. For more information on how to create an API, see Creating an API.

  1. Add the following configuration under the HttpGetRequestProcessors tag of the <EI_HOME>/conf/carbon.xml file to generate the Swagger JSON or YAML files.

    Code Block
    <Processor>
       <Item>swagger.json</Item>
       <Class>org.wso2.carbon.mediation.transport.handlers.requestprocessors.swagger.format.SwaggerJsonProcessor</Class>
    </Processor>
    <Processor>
       <Item>swagger.yaml</Item>
       <Class>org.wso2.carbon.mediation.transport.handlers.requestprocessors.swagger.format.SwaggerYamlProcessor</Class>
    </Processor>
  2. Open the terminal, navigate to the <EI_HOME>/bin directory and start the WSO2 EI profile.

    Linux/Mac./integrator.sh
    Windowsintegrator.bat --run
  3. Generate the Swagger docs:

    JSON
    Enter the following on the browser and the JSON
    file will download to your machine
    content will appear on the browser screen: http://<EI_HOST>:8280/<API_NAME>?swagger.json
    • By default, <EI_HOST> is localhost. However, if you are using a public IP, the respective IP address or domain needs to be specified.
    • Enter the APIs name for <API_NAME>.

      Note

      The API name is case sensitive. Therefore, make sure to the enter the API name correctly. Else, the JSON file will not download.

    Example: http://localhost:8280/HealthcareAPI?swagger.json

    Generate

    swagger

    Swagger docs for tenants

    If you want to generate the Swagger JSON file for a tenant, you need to enter the following on the browser
    :
    . http://<EI_HOST>:8280/t/<TENANT_DOMAIN>/<API_NAME>?swagger.json
    • By default, <EI_HOST> is localhost. However, if you are using a public IP, the respective IP address or domain needs to be specified.
    • Enter the value of the tenant domain for <TENANT_DOMAIN>.
    • Enter the APIs name for <API_NAME>.

    Example: http://localhost:8280/t/abc.com/HealthcareAPI?swagger.json

    YAML
    Enter the following on the browser and the YAML file will download to your machine: http://<EI_HOST>:8280/<API_NAME>?swagger.yaml
    • By default, <EI_HOST> is localhost. However, if you are using a public IP, the respective IP address or domain needs to be specified.
    • Enter the APIs name for <API_NAME>.

      Note

      The API name is case sensitive. Therefore, make sure to the enter the API name correctly. Else, the YAML file will not download.

    Example: http://localhost:8280/HealthcareAPI?swagger.yaml

    Generate swagger Swagger docs for tenants
    If you want to generate the Swagger YAML file for a tenant, you need to enter the following on the browser.

    http://<EI_HOST>:8280/t/<TENANT_DOMAIN>/<API_NAME>?swagger.yaml
    • By default, <EI_HOST> is localhost. However, if you are using a public IP, the respective IP address or domain needs to be specified.
    • Enter the value of the tenant domain for <TENANT_DOMAIN>.
    • Enter the APIs name for <API_NAME>.

    Example: http://localhost:8280/t/abc.com/HealthcareAPI?swagger.yaml

  4. Copy the content of the JSON or YAML file to the Swagger Editor or any other tool and check out the documentation of the API.