The steps mentioned in this section contains the usage of Docker containers and services to download and launch the images for Swagger Editor within a Docker container.
For more information about Docker, refer to the Docker documentation.
The following example uses Swagger Editor to view the REST API specification document. In this example, JSON Web Token (JWT) is used to authenticate the REST API.
Install and start the Swagger Editor.
Download the Swagger Editor image within a Docker container using the following command.
docker pull swaggerapi/swagger-editor
Launch the Docker container using the following command.
docker run -d -p 8888:8080 swaggerapi/swagger-editor
Paste the following address on a browser window to access the Swagger Editor using the specified host port.
http://localhost:8888/
Download the REST API specification document using the following command.
curl -H "Authorization: Bearer ${TOKEN}" "https://<Appliance IP address or Hostname>/pty/<Version>/<API>/doc" -H "accept: application/x-yaml" --output <api-doc>.yaml
In this command, TOKEN is the environment variable that contains the JWT token used to authenticate the REST API.
Drag and drop the downloaded <api-doc>.yaml file into a browser window of the Swagger Editor.
Perform the following steps to generate samples using the Swagger Editor.
Open the <api-doc>.yaml file in the Swagger Editor.
On the Swagger Editor UI, click on the required API request.
Click Try it out.
Enter the parameters for the API request.
Click Execute.
The generated Curl command and the URL for the request appears in the Responses section.