...
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>
Open the terminal, navigate to the
<EI_HOME>/bin
directory and start the WSO2 EI profile.Linux/Mac ./integrator.sh
Windows integrator.bat --run
Generate the Swagger docs:
JSON Enter the following on the browser and the JSON file will download to your machinecontent will appear on the browser screen:http://<EI_HOST>:8280/<API_NAME>?swagger.json
- By default,
<EI_HOST>
islocalhost
. 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 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>
islocalhost.
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>
islocalhost
. 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 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>
islocalhost.
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
- By default,
- 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.