FAQ

Requests to Intelligence APIs are blocked by the browser CORS policy

When facing this issue, you will find a CORS error like the one below:

Copy
Copied
Access to XMLHttpRequest from origin 'http://localhost:4200' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.

This error occurs when the browser is trying to make a request to a different origin (domain) than the one it's hosted on and the server the request is being sent to is not configured to allow cross-origin requests. The Access-Control-Allow-Origin header is used to specify which origins are allowed to access the resource. If this header is not present, the browser will block the request and the above error message will be displayed.

Unfortunately, for security reasons, we can't add "localhost" to the response 'Access-Control-Allow-Origin' HTTP header, so this issue must be solved from the API consumer side.

In order to solve this problem, we recommend using a REST client instead of a web browser. This would also ease the process of setting the proper HTTP Authorization headers as part of your requests.

Can I retrieve any Knowledge Model object available in the Celonis Platform through Intelligence APIs?

No, you will not be able to retrieve all the Knowledge Model objects available in the Celonis Platform. For reference, Intelligence APIs currently support:

How to retrieve Knowledge Model KPIs through the API

The Knowledge Model API does not provide a specific endpoint to retrieve the KPIs as they are defined in the Knowledge Model.

In order to extract KPIs it is necessary to configure them as attributes of a record in the Knowledge Model.

There are 2 ways to do this:

  1. Create an attribute inside a record and the KPI operator linking to the already existing KPI using its id.
  2. Create an attribute inside a record with the exact PQL formula for calculating the KPI.

Example:

Let's imagine that we have a Knowledge Model created for the Accounts Receivable process and we have a KPI defined in the Knowledge Model that calculates the total number of accounts with expired credit limit defined as follows:

  • name: COUNT CREDIT EXPIRED
  • id: count_credit_expired
  • PQL formula: COUNT ( CASE WHEN "ACCOUNT"."CREDIT_LIMIT_LOCAL" >= ${credit_limit_threshold} THEN 1 ELSE 0 END )

We can expose this KPI through the Knowledge Model API in the following way:

  1. Create a new record called, for example, COUNT_CREDIT with id count_credit
  2. Add a new attribute called, for example, EXPIRED with id expired
  3. Set the PQL formula of the attribute to any of the following values:
    1. KPI(count_credit_expired) (recommended if the KPI already exists in the Knowledge Model)
    2. COUNT ( CASE WHEN "ACCOUNT"."CREDIT_LIMIT_LOCAL" >= ${credit_limit_threshold} THEN 1 ELSE 0 END )

You can now retrieve the KPI as follows:

Call

Copy
Copied
/knowledge-models/intelligence-api.accounts-receivable/records/count_credit/data?fields=expired

Result:

Copy
Copied
{
   "page": 0,
   "pageSize": 20,
   "total": 1,
   "sort": [],
   "content": {
       "headers": [
           {
               "id": "expired",
               "name": "EXPIRED",
               "type": "string",
               "aggregation": true,
               "filterable": false,
               "sortable": true
           },
       ],
       "data": [
           {
               "expired": 56795
           }
       ]
   }
}

Is it possible to pull data from several Knowledge Model records with a single Intelligence API call?

The data endpoint of Intelligence API is built to consume data from a single Knowledge Model record, so the analyst will need to build in advance a record pulling all relevant attributes from multiple objects to exactly match the integration requirements. This record can then be consumed by Intelligence API.