inSync requires you to follow these steps to use the Report APIs:
Step 1: Obtain Authentication Information
Step 2: Access Report APIs through script
Obtain authentication information
inSync uses HTTP Basic authentication for API requests. inSync Cloud administrator can create the authentication information from the inSync Management Console.
The authentication information consists of the following components:
- Username: Email ID of the inSync Cloud administrator who creates the authentication token.
- Password: Authentication token that is generated.
inSync stores the authentication information in the database, that is encrypted with the ekey of your organization. Whenever you request to access the API, you must specify the username and the password.
- Log on to the inSync Management Console as an inSync Cloud administrator.
- On the inSync Management Console menu bar, click > Settings. The Settings page appears.
- Click the inSync APIs tab. The Access token for inSync APIs page appears.
- Click Copy Token. The token is copied to your clipboard.
The Copy Token button is available only when the authentication token is valid.
- If the token has expired, then click Create New Token and run the following steps:
- In the Expire on field, specify the expiry date of the authentication token.
- Click Done.
- Copy the token and retain it for requesting access to the API.
Note: By default, the token is valid for 30 days. The token's expiry date can be anywhere between 1 day to 365 days. You can create a new token even if the existing token is valid, if you feel that the token is compromised.
Access Report APIs through script
inSync uses basic authentication, which requires you to provide your username and password to authenticate each API request.
Run the following request query to access the desired Report API:
requests.get('https://insyncapi-cloud.druva.com/api/reports/vx/<API-name>', auth=('Username', 'Password'))
- vx - Version of inSync Reporting API. Replace it with the version of the API you are using. At the moment, following API versions are available:
- <API-name> - Name of the API which you want to call.
- Username - Email address of the inSync administrator who generated the token or authentication information in Step 1: Obtain authentication information.
- Password - API access token, generated in Step 1: Obtain authentication information.
Note: If you are a inSync GovCloud customer, you must use insyncapi-govcloud.druva.com or FQDN of your inSync GovCloud environment as your hostname in the Report API request query.
Sample Header Request for APIs
- Request: GET /api/reports/v1/<API-name> HTTP/1.1
- Host: cloud.druva.com or FQDN of your inSync Cloud.
- Authorization: Basic authentication