Generate the API Access Token

The following steps illustrate how to use Postman to generate an access token for a specified user and company.

1. Creating the Request

Create a new request in Postman as follows:

  1. Change the HTTP verb from GET to POST.

  2. Specify the URL to the Token/authenticateByApiKey API endpoint i.e., https://fslpresales.fslcgix-uat.co.uk/FSLPresales_WebAPI/api/Token/authenticateByApiKey.

  3. Add a request header with key ApiKey. The value should be set to the API key configured earlier in IIS (ServiceApiKey environment variable). For example, “95e37e3b-166f-4b3b-93aa-e2d2f09077a2”.

  4. Add a request header with key UserName. The value is the CGiX user to generate the reports for e.g. “CgixReportingUser”.

  5. Add a request header with key CompanyId. The value is the CGiX company ID associated to the provided CGiX user. For example, if user “CgixReportingUser” belongs to company with ID “FSL”, then set the CompanyId to “FSL”.

2. Sending the Request

Click the Send button to send the prepared request.

Response received in Postman

Request and response in Postman

3. The Response Body

The response returns an access token, its expiry date, expiry in minutes and the user name for which the token was created.

The token can now be used in the subsequent calls to the API to generate and access reports.

📘

Token Expiry

By default, the token is valid for 7 days or 10,080 minutes.

The token expiry duration in days can be changed in the CGiX Web API configuration file (appsettings.json).

"ApiKeyConfiguration": {
    "ExpiryInDays": 7
},