Configure the Service API Key

A token is required to access the Reporting API. An access token can be obtained by calling the authentication endpoint on the API in conjunction with an API key.

The API key must first be configured by setting the ServiceApiKey environment variable in IIS for the CGiX Web API as follows:

  1. Locate the Configuration Editor of the CGiX Web API in IIS.
IIS configuration editor

Configuration Editor in IIS

  1. Open the Configuration Editor, locate the system.webServer/aspNetCore section and set the environment variable ServiceApiKey to the desired value.
Setting the environment variable

Setting the environment variable

🚧

API Key

In this tutorial, we have used an online API key generator website to generate a key. As the key is a guid, it is 32 characters in length excluding the hyphens.

We recommend using longer keys which conform to your internal security policy i.e., minimum length, alphanumeric, etc.

📘

Using a Certificate

An alternative method for obtaining an access token is calling the authentication endpoint using a valid certificate. See Configure the API to use a Certificate.