Analytics REST API Key Management
The API Keys
Analytics uses two types of API keys:
- A System API key
- Scoped API keys
The System API Key
-
Created during the datastore installation and used by:
- AWI for Analytics and Reporting
- Data Collection Service
- Administrating the scoped API keys
Example of API Key created and displayed on the screen after installation:
Set the following property in your plugin.properties of the webui-plugin-analytics:
backend.api_key=c217e0db-6ada-4d0b-9ea3-1ef111ad208a
The file is located in the awi folder: /<Automic>/config/webui-plugin-analytics/plugin.properties
Scoped API Keys
- Created manually (system API Key required)
- Used by the Event Engine feature for injecting events (A given API key is scoped to a specific Automation Engine Client)
GET /analytics/api/v1/apikeys
RETURNS: A list of defined scoped API keys (i.e. this does NOT list the system API keys at all).
Headers:
Authorization: <SYSTEM API KEY>
Example:
[
{
"scope": "EVENTS",
"key": "UUID",
"client": 100,
"description": "some text"
}
]
The response is described using this JSON schema:
{
"type": array,
"items": {
"type": "object",
"properties": {
"scope": {
"type": "string",
"enum": ["TELEMETRY", "EVENTS"]
},
"key": {
"type": "string"
},
"client": {
"type": "integer",
"description": "This is required for EVENTS keys, ignored for TELEMETRY keys"
},
"description": {
"type": "string"
}
},
"required": ["scope", "key"]
}
}
POST
Creates a new API key.
POST /analytics/api/v1/apikeys
{
"scope": "EVENTS",
"client": 100,
"description": "some text"
}
Headers:
Authorization: <SYSTEM API KEY>
The POST body JSON schema:
{
"type": "object",
"properties": {
"scope": {
"type": "string",
"enum": ["TELEMETRY", "EVENTS"]
},
"client": {
"type": "integer",
"description": "This is required for EVENTS keys, ignored for TELEMETRY keys"
},
"description": {
"type": "string"
}
},
"required": ["scope"]
}
Response JSON schema:
{
"type": "object",
"properties": {
"scope": {
"type": "string",
"enum": ["TELEMETRY", "EVENTS"]
},
"key": {
"type": "string"
},
"client": {
"type": "integer",
"description": "This is required for EVENTS keys, ignored for TELEMETRY keys"
},
"description": {
"type": "string"
}
},
"required": ["scope", "key"]
}
Response example:
{
"key": "UUID",
"scope": "EVENTS",
"client": 100,
"description": "some text"
}
DELETE
Deletes an API key.
DELETE: /analytics/api/v1/apikeys/<UUID>
Headers:
Authorization: <SYSTEM API KEY>
See also: