External API
Analytica provides a set of APIs through which it is possible to modify the contents of the Knowledge Base.
Access and Authentication
From the company administration panel, it is possible to manage API Tokens, as well as monitor their usage.
Each token is associated with an Analytica user, and inherits from it all access rights to the Knowledge Base.
Documentation
The APIs are RESTful type, and accept authentication via Bearer token as authentication header.
To execute them, it is therefore necessary to specify the following header:
Authorization: Bearer <valid api token>
Batch API
Currently, a single batch type API is available at the following endpoint:
POST http://tryanalyicia.ai/api/info/batch
The request body is defined as follows:
[
{
"type": "<Knowledge Base type>",
"action": "<action type>",
"data": <json object>,
"key_name": "<key name for matching>"
}
]
where:
typemust correspond to the name of a defined Knowledge Base type;actioncan be "CREATE", "UPDATE", "DELETE", "UPSERT", to perform different operations on the data;datais a json object that represents the data to be inserted. During updates, this data will replace any existing data in its entirety;key_namecontains the name of the property on which to do "matching" in the data update.
An example in cURL of the API call is as follows:
curl --request POST \
--url https://tryanalytica.ai/api/info/batch \
--header 'Authorization: Bearer <api token>' \
--header 'Content-Type: application/json' \
--data '[
{
"type": "Cat",
"action": "UPDATE",
"data": {
"name": "Gigi",
"badness": 18
},
"key_name": "name"
}
]'
In this example, a Knowledge Base data of type Cat will be updated with the data defined in data. The original object that will be updated will be the one that has, in the name field (defined by key_name), the value Gigi.
With this Batch API it is possible to execute multiple operations both of different types and on different Knowledge Base types.