# Get Thing Events Logs

## View Events Logs

<mark style="color:green;">`POST`</mark> `https://console.monogoto.io/thing/searchCDR`

#### Headers

| Name                                          | Type   | Description               |
| --------------------------------------------- | ------ | ------------------------- |
| YOUR\_TOKEN<mark style="color:red;">\*</mark> | String | Your authentication token |
| CUSTOMER\_ID                                  | String | Customer API key          |

#### Request Body

| Name                                    | Type   | Description           |
| --------------------------------------- | ------ | --------------------- |
| ICCID<mark style="color:red;">\*</mark> | String | The ICCID of your SIM |
| EVENT\_SEVERITY                         | String |                       |
| GREATER\_OR\_EQUAL\_TIMESTAMP           | String |                       |
| LESS\_TIMESTAMP                         | String |                       |
| EVENT\_DATA\_TYPE                       | String |                       |
| EVENT\_MESSAGE\_TYPE                    | String |                       |
| RESULTS\_LIMIT                          | String |                       |

{% tabs %}
{% tab title="200: OK " %}

```javascript
{
    // Response
}
```

{% endtab %}
{% endtabs %}

### Example using **cURL**:

```bash
curl -X POST \
    --url "https://console.monogoto.io/thing/searchCDR" \
    -H "accept: application/json" \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer {TOKEN_HERE}" \
    -H "apikey: {CUSTOMER_ID}" \
    -d "{ \"ThingIdELK\": \"ThingId_ICCID_{ICCID}\", \"SeverityELK\": \"{EVENT_SEVERITY}\", \"gteTimestampELK\": \"{GREATER_OR_EAQUAL_TIMESTAMP}\", \"ltTimestampELK\": \"{LESS_THAN_TIMESTAMP}\", \"EsDataTypeELK\": \"{EVENT_DATA_TYPE}\", \"MessageTypeELK\": \"{EVENT_MESSAGE_TYPE}\", \"limit\": \"{RESULTS_LIMIT}\"}"
```

{% hint style="info" %}
Please note that the above shown command needs to be replaced with information:&#x20;

**{TOKEN\_HERE}** - replace with your token

**{CUSTOMER\_ID}** - replace with your customer ID. You may obtain Customer ID during the [authentication](/developer/api/how-to-obtain-login-token.md)

**{ICCID}** - replace with the ICCID of your SIM

**{EVENT\_SEVERITY}** - replace with the severity of the Event you wish to be displayed

**{GREATER\_OR\_EQUAL\_TIMESTAMP}** - replace with the timestamp of date/time to show greater or equal date/time Events. Please enter date/time in epoch format with milliseconds. [You may use a converter that can be found following this link](https://www.epochconverter.com/)

**{LESS\_TIMESTAMP}** - replace with the timestamp of date/time to show less than entered date/time Events. Please enter date/time in epoch format with milliseconds. [You may use a converter that can be found following this link](https://www.epochconverter.com/)

**{EVENT\_DATA\_TYPE}** - replace with the Event message type to be displayed.  You may find data types list [following this link](https://docs.monogoto.io/tips-and-tutorials/platform/thing-menu-events/event-data-types)

**{EVENT\_MESSAGE\_TYPE}** - replace with the Event message type to be displayed

**{RESULTS\_LIMIT}** - replace with how many results you want to be displayed. Default when not using this line is 10 results
{% endhint %}

Example of request that will show last **50 Events for our Thing**:

```bash
curl -X POST \
    --url "https://console.monogoto.io/thing/searchCDR" \
    -H "accept: application/json" \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer eyJhb6IkpXVCJ9.eyJSb2xlIjoiVXN4lclByb2ZpbGVJZF9kZGM2MThhNC0wNTI1LTQ2MmUtYWN3NzhhMGQxYmbSI6Im4zgFkbWluIiwiQ3VzdG9tsbCwiVXNlcklkIjoiVklkXzg5Yj5Y2OGEyUtNDQThhLTEzZjA0MzJhZDE3YyINTAzgZmUtZGI51My00ZjRiLTktN2U5Yjc0ZWU1ZThlIiwiaWNzM3MjI5L2MDY3NTE2Mjl9.99aSLzP7kTgK6TZGW-xalrMu0GkW6viunt3XxbNng" \
    -H "apikey: cid_eb424686-8943a-4f4h4-9b6d-3627a666333b" \
    -d "{ \"ThingIdELK\": \"ThingId_ICCID_8912372646888991\", \"limit\": \"50\"}"
```

Expected result will show 50 last Events for our Thing:

```json
{
  "totalResults": 151,
  "hits": [
    {
      "_source": {
        "EsDataType": "GGSN_AUTHENTICATE_PDP_CONTENT_RESULT",
        "Severity": "Info",
        "message": "Success authenticate_pdp_context for Thing ICCID 8912372646888991 MNO= UAB TELE2. Session ID =8993090, Allowed Bytes= 20971520",
        "Timestamp": 1609154365332,
        "MessageType": "EVENT"
      }
    },
    {
      "_source": {
        "EsDataType": "GGSN_AUTHENTICATE_PDP_CONTENT",
        "Severity": "Info",
        "message": "authenticate_pdp_context v2 for Thing=ICCID 8912372646888991 from SGSN 10.99.5.34 RAI=null . Allowed Bytes = 20971520",
        "Timestamp": 1609154365331,
        "MessageType": "EVENT"
      }
    },
    {
      "_source": {
        "EsDataType": "GGSN_DELETE_PDP_CONTENT",
        "Severity": "Info",
        "message": "delete_pdp_context for Thing=ICCID 8912372646888991, Session ID=8986961, Used bytes=18464019",
        "Timestamp": 1609154364198,
        "MessageType": "EVENT"
      }
      
      
      ...
```

Example request that will show only **Event CDR results for our Thing**:

```bash
curl -X POST \
    --url "https://console.monogoto.io/thing/searchCDR" \
    -H "accept: application/json" \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer eyJhb6IkpXVCJ9.eyJSb2xlIjoiVXN4lclByb2ZpbGVJZF9kZGM2MThhNC0wNTI1LTQ2MmUtYWN3NzhhMGQxYmbSI6Im4zgFkbWluIiwiQ3VzdG9tsbCwiVXNlcklkIjoiVklkXzg5Yj5Y2OGEyUtNDQThhLTEzZjA0MzJhZDE3YyINTAzgZmUtZGI51My00ZjRiLTktN2U5Yjc0ZWU1ZThlIiwiaWNzM3MjI5L2MDY3NTE2Mjl9.99aSLzP7kTgK6TZGW-xalrMu0GkW6viunt3XxbNng" -H "apikey: cid_eb424686-8943a-4f4h4-9b6d-3627a666333b" \
    -d "{ \"ThingIdELK\": \"ThingId_ICCID_8912372646888991\", \"MessageTypeELK\": \"CDR\",}"
```

Expected result will show only CDR Events for our Thing:

```json
{
  "totalResults": 31,
  "hits": [
    {
      "_source": {
        "EsDataType": "DATA",
        "Severity": "Info",
        "message": "ICCID 8912372646888991 used 1440448 bytes ",
        "Timestamp": 1612339903864,
        "MessageType": "CDR"
      }
    },
    {
      "_source": {
        "EsDataType": "DATA",
        "Severity": "Info",
        "message": "ICCID 8912372646888991 used 1222281 bytes ",
        "Timestamp": 1612339856758,
        "MessageType": "CDR"
      }
    },
    {
      "_source": {
        "EsDataType": "MT_SMS",
        "Severity": "Info",
        "message": "Success. txId=ThingId_ICCID_8912372646888991_1612339830744_0.5133170465420831 SMS txId=ThingId_ICCID_8912372646888991_1612339830744_0.5133170465420831 from console to ICCID 8912372646888991",
        "Timestamp": 1612339831262,
        "MessageType": "CDR"
      }
    },
    
    ...
```

Example request that will show only our **entered SIM open data sessions Events**:

```bash
curl -X POST \
    --url "https://console.monogoto.io/thing/searchCDR" \
    -H "accept: application/json" \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer eyJhb6IkpXVCJ9.eyJSb2xlIjoiVXN4lclByb2ZpbGVJZF9kZGM2MThhNC0wNTI1LTQ2MmUtYWN3NzhhMGQxYmbSI6Im4zgFkbWluIiwiQ3VzdG9tsbCwiVXNlcklkIjoiVklkXzg5Yj5Y2OGEyUtNDQThhLTEzZjA0MzJhZDE3YyINTAzgZmUtZGI51My00ZjRiLTktN2U5Yjc0ZWU1ZThlIiwiaWNzM3MjI5L2MDY3NTE2Mjl9.99aSLzP7kTgK6TZGW-xalrMu0GkW6viunt3XxbNng" \
    -d "{ \"ThingIdELK\": \"ThingId_ICCID_8912372646888991\", \"EsDataTypeELK\": \"GGSN_AUTHENTICATE_PDP_CONTENT_RESULT\"}"
```

Expected result:

```json
{
  "totalResults": 6,
  "hits": [
    {
      "_source": {
        "EsDataType": "GGSN_AUTHENTICATE_PDP_CONTENT_RESULT",
        "Severity": "Info",
        "message": "Success authenticate_pdp_context for Thing ICCID 8912372646888991 MNO= OMNITEL. Session ID =123456789, Allowed Bytes= 20971520, IP : 11.111.111.181",
        "Timestamp": 1649772356750,
        "MessageType": "EVENT"
      }
    },
    {
      "_source": {
        "EsDataType": "GGSN_AUTHENTICATE_PDP_CONTENT_RESULT",
        "Severity": "Info",
        "message": "Success authenticate_pdp_context for Thing ICCID 8912372646888991 MNO= OMNITEL. Session ID =123456789, Allowed Bytes= 20971520, IP : 11.111.111.181",
        "Timestamp": 1649767305888,
        "MessageType": "EVENT"
      }
    },
    ...
```

Example request that will show only our **entered SIM closed data sessions Events**:

```bash
curl -X POST \
    --url "https://console.monogoto.io/thing/searchCDR" \
    -H "accept: application/json" \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer eyJhb6IkpXVCJ9.eyJSb2xlIjoiVXN4lclByb2ZpbGVJZF9kZGM2MThhNC0wNTI1LTQ2MmUtYWN3NzhhMGQxYmbSI6Im4zgFkbWluIiwiQ3VzdG9tsbCwiVXNlcklkIjoiVklkXzg5Yj5Y2OGEyUtNDQThhLTEzZjA0MzJhZDE3YyINTAzgZmUtZGI51My00ZjRiLTktN2U5Yjc0ZWU1ZThlIiwiaWNzM3MjI5L2MDY3NTE2Mjl9.99aSLzP7kTgK6TZGW-xalrMu0GkW6viunt3XxbNng" \
    -d "{ \"ThingIdELK\": \"ThingId_ICCID_8912372646888991\", \"EsDataTypeELK\": \"GGSN_DELETE_PDP_CONTENT\"}"
```

Expected result:

```json
{
  "totalResults": 5,
  "hits": [
    {
      "_source": {
        "EsDataType": "GGSN_DELETE_PDP_CONTENT",
        "Severity": "Info",
        "message": "delete_pdp_context for Thing=ICCID 8912372646888991, Session ID=7711111, Used bytes=1804182 IP : 11.111.111.181",
        "Timestamp": 1649767320663,
        "MessageType": "EVENT"
      }
    },
    {
      "_source": {
        "EsDataType": "GGSN_DELETE_PDP_CONTENT",
        "Severity": "Info",
        "message": "delete_pdp_context for Thing=ICCID 8912372646888991, Session ID=7711111, Used bytes=2846124 IP : 11.111.11.181",
        "Timestamp": 1649767024954,
        "MessageType": "EVENT"
      }
    },
...
```

{% openapi src="/files/lqgrtNg1pOcbxIdacwgh" path="/thing/searchCDR" method="post" %}
[JPU\_CustomerAPIV\_Without\_Test it.yaml](https://3922449203-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0mPxGpottOEfcucXOR%2Fuploads%2FXtNpEMk17YOUrC39Cmvr%2FJPU_CustomerAPIV_Without_Test%20it.yaml?alt=media\&token=09b74b38-dd09-4edc-8f98-4df792b3c986)
{% endopenapi %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.monogoto.io/developer/api/things/how-to-view-thing-events-log.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
