Access Versa Director REST APIs Using Swagger UI
For supported software information, click here.
Versa Director is integrated with Swagger, which provides a webpage to display the Director REST APIs. You can use Swagger UI to run real-time REST API commands and to export the APIs as YAML or JSON files that you can use to generate client code.
Versa Director provides REST APIs so that you can integrate upstream (northbound) applications. A number of integration options allow you to customize the integration of applications. For more information, see Versa Director REST API Overview.
This article describes how to access the Swagger webpage, navigate to different APIs by section, export and download APIs, and generate client code for the API file.
Note that to access the Swagger webpage, you need the management IP address or domain name of the Versa Director on which you want to execute the REST APIs. No additional permissions are required to run the REST API client.
Access the Swagger Webpage
- Open a browser and enter a URL in one of the following formats to open the Swagger web page:
https://director_ip_address:9182/docs/swagger-ui.html
https://director_hostname:9182/docs/swagger-ui.html
Note that in Chrome, when you are on the NET::ERR_CERT_INVALID tab, you may have to accept a certificate or accept the "This is unsafe" option to proceed.
- The Swagger webpage for the Director REST APIs displays.
- To grant different levels of access to API data for different users, click Authorize. The Available Authorizations window displays, and you can set authorization scopes.
- Enter the login credentials to log in to Versa Director.
- Click Authorize to save the changes.
Navigate to the Director REST APIs
- On the Swagger webpage, select an API in the Select a Spec field in the top menu bar.
The selected API details are displayed in the main window. The following screen displays the Alarms API group.
- To change the values of an API, click Try It Out and update the required fields.
- Click Execute.
Export APIs To Generate Client Code
Swagger UI allows you to export a selected API group or all API groups as YAML or JSON files. You can also download the files as .zip files.
To export APIs:
- In the Swagger webpage, select Export YAML or JSON Document API in the Select a Spec field in the top menu bar.
- Click Export Documents in the main screen. The Export YAML or JSON Document Based on Group section displays.
- Click Try it Out, and enter the following information:
- In the docType field, select JSON or YAML as the file type.
- In the Group field, select the API group you want to export or select All APIs to export all Director REST API groups.
- Click Execute.
- To download the API group file (JSON or YAML) as a .zip file to the local device, click Download File, and then save the file.
Generate Client Code
To generate client code for the downloaded API file (JSON or YAML):
- Navigate to https://editor.swagger.io/. The SwaggerEditor webpage displays.
- Click File > Import file, and then select the API file you saved in Export APIs To Generate Client Code, above.
- Click Generate Client, and select a client and the language of the code to generate.
- Save the file at the desired location.
Supported Software Information
Releases 21.2 and later support all content described in this article.