# Try it!

If after reading the documentation you want to give the Knowledge Model API a try, we have prepared a
demo environment that anyone can access. Authentication is required, but any token
that you pass should work, so no need to get a User or Application key in advance.

To show how this environment works, we will use Postman, but you can use any other REST client.

The URL where this API can be located is: `https://16abf815-424c-413e-b92d-6c6f8fc633cd.remockly.com/intelligence/api`. Keep in mind that
for real production environments, the URL typically ends with `/intelligence/api` and not `/api`.

## 1. Create a new HTTP Request

Let's start this Tutorial by creating a new HTTP Request in Postman (File > New > HTTP Request). Make sure that you have
selected a GET operation and paste the URL for the API next to it: `https://16abf815-424c-413e-b92d-6c6f8fc633cd.remockly.com/intelligence/api`.

![Create a new HTTP Request](/assets/mock-step1.a2d6032743d2d7ddaa4c957eac4d54246350eac78464761b5a776d164e8eca88.3c53a942.png)

## 2. Configure authentication

Let's say we have our User API Key which is
`NASDYUmYxMjItNmJJHuNYSdn7FkLThhasdhj89jM2ODVmOio090sadjkdkVnRFV3VVBtZ1jksadb8olJWXMSDHUASDik3UE5j`. Go to Postman
and use this key for the Authentication header.
Click on `Authorization` and select `Bearer Token` for the Type. For the token, paste the above key.

![Configure authentication](/assets/mock-step2.639caa743ba3d49f625a341eb4629a616b7d47b4c13c2e51e3bdb54dc60b019d.3c53a942.png)

## 3. Get the list of Knowledge Models

Now we should be ready to start getting some information such as the full list of Knowledge Models. For that,
you need to add '/knowledge-models' at the end of the URL. As we can see, there is one Knowledge Model with the id
`open-purchase-requisition.purchase-requisition-km` and named `Purchase Requisition KM`. As we can tell by the name, this
Knowledge Model is giving us information about purchases that happened in the company.

![Get list of Knowledge Models](/assets/mock-step3.76f688efe99b5c49be4b6f5065bea41e71f8e5b72d64d52180a5b4332acbcce5.3c53a942.png)

## 4. Getting details for a specific Knowledge Model

Next, let's see the details for the `Purchase Requisition KM` Knowledge Model. In order to do that, we need to append the
id of the Knowledge Model to the URL we used for the previous step. In the results we can get extra information for this
Knowledge Model, for example that is extending another Knowledge Model with id `open-purchase-requisition.purchase-requisition-km-base`.

![Getting details for a specific Knowledge Model](/assets/mock-step4.f6a650bcaf08a15cb580ab1a8be0e1eca4092b70832251584eb59ab930c9a393.3c53a942.png)

## 5. Get KPIs for a Knowledge Model

Imagine you want to retrieve all the KPIs within a Knowledge Model. This is possible just adding the Knowledge Model id,
for example `open-purchase-requisition.purchase-requisition-km-base` and later appending `/kpis` to the URL.

![Get the triggers for a knowledge model](/assets/mock-step17.77efae7d190e918202ad665818e0743831384086b56b8c831836282eda53ec0e.3c53a942.png)

## 6. Get data across any records & KPIs of a Knowledge Model

Finally, it's time to consume the data from different records and KPIs of the Knowledge Model. For this we need to first append `/data` to the URL we got
in step #4. Then, we should also specify the field Ids and the KPI Ids that we want to retrieve. For this last step, add a parameter
in the `Params` tab named `fields` with the value `MATERIALS.ACTIVITY` and one with name `kpis` and the value `AVG_EVENTS_PER_CASE,FILTERED_COUNT`. The result:

![Get the data for the Materials record](/assets/mock-step18.fcd9b62c582ec5d01af39cfda1584d9889f462981f863a1fdbd07b36a98513b3.3c53a942.png)