Evaluation in Swagger UI
You can use the Swagger UI to evaluate and explore capabilities of the Veeam Backup for Microsoft 365 REST API. The Swagger UI framework allows you to interact with the Veeam Backup for Microsoft 365 REST API in a sandbox UI. The Swagger UI visually presents API specification files and allows you to work with resources.
All resources and methods are expandable. When you expand a method, you get a full description of available parameters and an automatically generated example. You can also send requests and see response messages.
To access the Swagger UI for Veeam Backup for Microsoft 365 REST API, in a web browser, navigate to the following URL:
https://<hostname>:<port>/swagger/ui/index/index.html |
where:
- <hostname> is the DNS name or IP address of the server where Veeam Backup for Microsoft 365 is installed.
- <port> is the port number. The default port number is 4443.
Obtaining Authorization Token
To start working with Swagger UI, you must first authorize your access to the Veeam Backup for Microsoft 365 REST API resources.
Authorization process involves obtaining an authorization token that must be used in all requests during the session.
To obtain an authorization token, do the following:
- From the Select a definition drop-down list, select the REST API version API v8.
- Expand the Auth resource and click POST /v8/token.
- Click Try it out.
- From the grant_type drop-down list, make sure that the password value is selected.
- In the username and password fields, specify credentials for authenticating to the Veeam Backup for Microsoft 365 server.
- Click Execute.
Note |
The client_id and assertion parameters are used in the scenario of data restore for tenant Microsoft 365 organizations with modern app-only authentication. For more information, see Authorization for Organizations with Modern App-Only Authentication. |
Adding Authorization Token
Wait for the response from the server. A successfully completed operation returns the 200 OK response code. In the response body, Veeam Backup for Microsoft 365 returns an access token, its expiration time and a refresh token.
Save the access and refresh tokens locally for further use.
Tip |
You can download a server response in the JSON format. To do that, in the expanded method window, click Download in the lower-right corner of the Response body field. |
To authorize your access in the Swagger UI, do the following:
- In the top-right corner of the Veeam Backup for Microsoft 365 REST API page, click Authorize.
- In the Available authorizations dialog, insert the access token saved locally in the Value field.
- Click Authorize.
- Wait for the response from the server, review the information and click Close.
Using Refresh Token
When the access token expires, you can either obtain a new access token or renew the access token using the refresh token.
To use the refresh token, do the following:
- Expand the Auth resource and click POST /v8/token.
- Click Try it out.
- From the grant_type drop-down list, select refresh_token.
- In the refresh_token field, insert the refresh token that you saved locally.
- Click Execute.
Wait for the response from the server. A successfully completed operation returns the 200 OK response code and a new pair of tokens in the response body. Save the access and refresh tokens locally for further use.
Sending Request
After you get authorization, you can send HTTP requests to Veeam Backup for Microsoft 365 REST API collections and resources in the Swagger UI.
To send a request, do the following:
- Expand the required resource and select the request method.
- Click Try it out.
- Specify parameter values if required.
- Click Execute.
Getting Response
The Swagger UI returns a response body as well as a response code and response headers. Additionally the Swagger UI generates a curl command and a URL for your request.
Tip |
You can download a server response in the JSON format. To do that, in the expanded method window, click Download in the lower-right corner of the Response body field. |