Using Report APIs


inSync requires you to follow these steps to consume the Report APIs,
Step 1: Obtain authentication information
Step 2: Access Report APIs through script
Obtain authentication information
Overview
inSync uses HTTP Basic authentication for API requests. inSync Server administrator can create the authentication information from the inSync Master Management Console.
The authentication information consists of the following components:
- Username: Email ID of the inSync Server 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.
Procedure
- Log on to the inSync Management Console as an inSync Server administrator.
- On the inSync Management Console menu bar, click
> Settings. The Settings page appears.
- Click the Access Token tab. The Access token for inSync APIs page appears.
- If the token is valid, then click Copy Token. The token is copied to your clipboard.
Note: 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:
Note: You can create a new token even if the existing token is valid, if you feel that the token is compromised. For example, stolen.
- In the Expire on field, specify the expiry date of the authentication token.
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.
- Click Done.
- In the Expire on field, specify the expiry date of the authentication token.
- Copy the token and retain it for requesting access to the API.
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://<IP address or FQDN of inSync Server>/api/reports/v1/<API-name>', auth=('Username', 'Password'))
where,
- v1 - Version 1 of inSync Reporting API.
- <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.
Sample Header Request for APIs
- Request: GET /api/reports/v1/<API-name> HTTP/1.1
- Host: IP address or FQDN of your inSync Server.
- Authorization: Basic authentication