# Check if MT SMS was Received

{% hint style="warning" %}
Before using this API, please make sure that your SIM card profiles and your Monogoto account supports MT SMS functionality
{% endhint %}

## Check if MT SMS was received

<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<mark style="color:red;">\*</mark> | String | Customer API key          |

#### Request Body

| Name                 | Type   | Description                                                                                                                                          |
| -------------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
| ICCID                | String | The ICCID of your SIM                                                                                                                                |
| EVENT\_DATA\_TYPE    | String | The Event message type to be displayed. [Read more](https://docs.monogoto.io/tips-and-tutorials/platform/thing-menu-events/event-data-types)         |
| EVENT\_MESSAGE\_TYPE | String | Replace with the Event message type to be displayed. [Read more ](https://docs.monogoto.io/tips-and-tutorials/platform/thing-menu-events/event-type) |
| LIMIT                | String | Replace with the amount of results you would like to see                                                                                             |

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

```javascript
{
  "totalResults": 2,
  "hits": [
    {
      "_source": {
        "EsDataType": "MT_SMS",
        "Severity": "Info",
        "message": "Success. txId=ThingId_ICCID_8912372646888991_1636397785991_0.7279801033980184 SMS txId=ThingId_ICCID_8912372646888991_1636397785991_0.7279801033980184 from console to ICCID 8912372646888991",
        "Timestamp": 1636397786551,
        "MessageType": "CDR"
      }
    },
    {
      "_source": {
        "EsDataType": "MT_SMS",
        "Severity": "Info",
        "message": "Success. txId=ThingId_ICCID_8912372646888991_1636111732365_0.10960520849291022 SMS txId=ThingId_ICCID_8912372646888991_1636111732365_0.10960520849291022 from console to ICCID 8912372646888991",
        "Timestamp": 1636111734800,
        "MessageType": "CDR"
      }
    }
  ]
}
```

{% endtab %}

{% tab title="401: Unauthorized Unauthorized" %}

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

{% endtab %}

{% tab title="400: Bad Request Invalid Input Data" %}

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

{% endtab %}
{% endtabs %}

{% hint style="info" %}
Please note that in order for SMS message to reach a Thing, it must be connected to the network.
{% endhint %}

### 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 {YOUR_TOKEN}" \
    -H "apikey: {CUSTOMER_ID}" \
    -d "{ \"ThingIdELK\": \"ThingId_ICCID_{ICCID}\", \"EsDataTypeELK\": \"{EVENT_DATA_TYPE}\", \"MessageTypeELK\": \"{EVENT_MESSAGE_TYPE}\", \"limit\": \"{:LIMIT}\"}"    
```

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

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

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

**{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. You may find message types list [following this link](https://docs.monogoto.io/tips-and-tutorials/platform/thing-menu-events/event-type)

**{LIMIT}** - replace with the number of results you would like to see that are matching your search results. Entering **1** will show the last SMS result.

If needed this API can be tested and used in the Monogoto Console following this path: **Thing** POST <mark style="color:red;">`/thing/searchCDR`</mark>
{% endhint %}

Example of request:

```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\", \"EsDataTypeELK\": \"MT_SMS\", \"MessageTypeELK\": \"CDR\", \"limit\": \"1\"}"
```

Example of expected result showing last 1 MT SMS from the portal that was successful:

```json
{
  "totalResults": 1,
  "hits": [
    {
      "_source": {
        "EsDataType": "MT_SMS",
        "Severity": "Info",
        "message": "Success. txId=ThingId_ICCID_8912372646888991_1636397785991_0.7279801033980184 SMS txId=ThingId_ICCID_8912372646888991_1636397785991_0.7279801033980184 from console to ICCID 8912372646888991",
        "Timestamp": 1636397786551,
        "MessageType": "CDR"
      }
    }
  ]
}
```

{% hint style="info" %}
Please note that in order to know the human date/time please use Epoch time converter. [You can find it following this link.](https://www.epochconverter.com/)
{% endhint %}

{% openapi src="<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>" 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 %}
