Requesting Authorization

The Veeam Backup for Nutanix AHV REST API accepts the password grand type to authenticate a Veeam Backup for Nutanix AHV user.

To obtain authorization tokens, a user sends the HTTP POST request to the api/v5/token endpoint.

The request body must contain the grantType parameter with the specified password value and the credentials of a Nutanix AHV backup appliance administrator.

A successfully completed operation returns the 200 response code. In the response body, Veeam Backup for Nutanix AHV returns an access token, a refresh token and expiration time of each token. The user inserts the access token in headers of further requests to the Veeam Backup for Nutanix AHV REST API. The refresh token must be saved locally.

To learn how to authorize your access using the Password grant type, see the example below. Alternatively, you can use the Swagger UI.

Requesting AuthorizationExample

To obtain an access token and a refresh token, a user sends the HTTP POST request to the api/oauth2/token endpoint.

In the request body, the user specifies the following parameters:

  • grantType — the password value must be specified for this parameter.
  • userName and password — credentials used to access the server; in this example, administrator and Password1 are used.

Request:

POST https://127.0.0.1/api/oauth2/token

 

 

Request Body:

grantType=Password&userName=administrator&password=Password1

The server sends a response in the following format.

Response:

200

Response Body:

{

 "accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJkYjM4Y2M1YS0zYTQ5LTRkMjYtYmM3MS1hOWY2N2NiNmRjYWEiLCJuYW1laWQiOiIxMDAwIiwidW5pcXVlX25hbWUiOiJhZG1pbiIsInNpZCI6Ijc2ZDEwOTY0LWIwMDktNDNiOC1iZWFkLWIwNjZmOTE2NmFmMSIsIm5iZiI6MTY2NzIyMzM0OCwiZXhwIjoxNjY3MjI1MTQ4LCJpYXQiOjE2NjcyMjMzNDgsImlzcyI6Imlzc3VlciIsImF1ZCI6ImFwaS9kZWZhdWx0LzY1MjZmOTg1LTY3MGMtNDc2Zi05YmI3LTlhODlhMGIxNDM3NCJ9.2hXtW1nrZnUiIMy0VeUE-pr0WRY6MkoeD79SgsxlUqceyJhbGciOiJSUzUxMiIsImtpZCI6IjQ2MDU0QjExNTE3Njk0QzAxN0IyRTE2MTQyNURCRDM1QkNGNzY3NkQiLCJ0eXAiOiJKV1QifQ.eyJ1b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