How to Ping Thing IP Address?

This guide will show you how can you use API to ping your SIM card IP address. Ping is very useful to check if SIM card is still active and can be used to prevent from being purged from network.

To get the Thing IP address, please use following request:

curl -X GET "https://console.monogoto.io/thing/ThingId_ICCID_<<<_THING_ICCID_>>>/" -H "accept: application/json" -H "Authorization: Bearer <<<_TOKEN_HERE_>>>"

Please note that the above shown command needs to be replaced with information: <<<_THING_ICCID_>>> - replace with your Monogoto thing ICCID number <<<_TOKEN_HERE_>>> - replace with your token. You may obtain Token, by running Login Token API command. If needed this API can be tested and used in the Monogoto portal following this path: Thing GET /thing/{ThingId}/

Example of request to obtain Thing IP address:

curl -X GET "https://console.monogoto.io/thing/ThingId_ICCID_8912372646888991/" -H "accept: application/json" -H "Authorization: Bearer eyJhb6IkpXVCJ9.eyJSb2xlIjoiVXN4lclByb2ZpbGVJZF9kZGM2MThhNC0wNTI1LTQ2MmUtYWN3NzhhMGQxYmbSI6Im4zgFkbWluIiwiQ3VzdG9tsbCwiVXNlcklkIjoiVklkXzg5Yj5Y2OGEyUtNDQThhLTEzZjA0MzJhZDE3YyINTAzgZmUtZGI51My00ZjRiLTktN2U5Yjc0ZWU1ZThlIiwiaWNzM3MjI5L2MDY3NTE2Mjl9.99aSLzP7kTgK6TZGW-xalrMu0GkW6viunt3XxbNng"

Example of received result showing Thing IP address:

{
"ThingName": "ICCID 8912372646888991",
"ThingDescription": "Auto-activated by provision process",
"ActiveMobileSubscriber": "123456789101112",
"State": "ACTIVE",
"BatchId": "SIM Card",
"MSISDN": "+4420412389916",
"ExternalUniqueId": "8912372646888991",
"ExternalUniqueType": "ICCID",
"ExternalBatchId": "Partner SIM",
"OrganizationId": "OrganizationId_23789d7d-dd59-4739-ab2c-1ec7d9d8b11a",
"CreatedBy": "UserId_90b777a3-60f5-4557-958ba-15f04333d17b",
"ThingsGroupId": "ThingsGroupId_ca140991-be66-4ddd-a777-711595c5a30d",
"CustomerId": "cid_c256463da-742-491b-911b-8850177ef5121",
"DateAssignedToCustomer": 1610443297454,
"SimType": null,
"IPs": [
{
"IP": "11.111.11.211",
"IPAllocationPolicy": "dynamic",
"IPLock": false,
"IPPoolId": "IPPoolId_0cbby8ae-ddx7-4nx6-8588-b7e451f114e3",
"IPvType": "IPv4",
"NetworkId": "NetworkId_ec8dc935-35a1-499a-aacd-4e190ad41673",
"ApnShortId": "1000"
}
...

Now that we have Thing IP address, please use the following request to ping Thing IP address:

curl -X POST "https://console.monogoto.io/thing/ThingId_ICCID_<<<_THING_ICCID_>>>/ping" -H "accept: application/json" -H "Content-Type: application/json" -H "Authorization: Bearer <<<_TOKEN_HERE_>>>" -H "apikey: <<<_CUSTOMER_ID_>>>" -d "{ \"IPAddress\": \"<<<_THING_IP_ADDRESS_>>>\"}"

Please note that the above shown command needs to be replaced with information: <<<_THING_ICCID_>>> - replace with your Monogoto thing ICCID number <<<_TOKEN_HERE_>>> - replace with your token <<<_CUSTOMER_ID_>>> - replace with your customer ID. It can be received together with a Login Token or from request to obtain Thing IP address. <<<_THING_IP_ADDRESS_>>> - replace with your thing IP address If needed this API can be tested and used in the Monogoto portal following this path: Thing POST /thing/{ThingId}/ping

Example of request:

curl -X POST "https://console.monogoto.io/thing/ThingId_ICCID_8912372646888991/ping" -H "accept: application/json" -H "Content-Type: application/json" -H "Authorization: Bearer eyJhbGciOiJIUzI1N2R5cCI6IkpXVCJ9.eyJSb2x5oiVXNlclByb2ZpbGVJZF9kZGM2MThhNC0wNTI1LTQ2MmUtYtNlNt03NzhhMGQxYmQyNGYiLCJSZWFsiSI6ImFkbWluIiwiQ3VzdG9tZXJJZfI6bnVsbCwiVXNlcklkIjoiVXNlcklkXzg52OG486TUwZjUtNDQ1Ny05NThhLTEzZjA0MzJhZDE3YyIsImp3dGlkIjoiZjE0iMzZWYtZjViNC00MzQ1LWFlZWQag1YWM1NWUzNjQ5IiwiaWF0IjoxN784MTA2LCJleHAiOjE2MDMyMTI15DZ9.7U26dqOGSz-4qZJaG6bC4J6--0x3-_6dAWLRTALXMAk" -H "apikey: cid_c256463da-742-491b-911b-8850177ef5121" -d "{ \"IPAddress\": \"13.140.90.211\"}"

Example of response to our request showing the thing IP address ping results:

[
{
"host": "11.111.11.211",
"size": "56",
"ttl": "63",
"time": "82ms",
"sent": "1",
"received": "1",
"packetLoss": "0"
},
{
"host": "11.111.11.211",
"size": "56",
"ttl": "60",
"time": "89ms",
"sent": "2",
"received": "2",
"packetLoss": "0"
},
{
"host": "11.111.11.211",
"size": "56",
"ttl": "73",
"time": "60ms",
"sent": "3",
"received": "3",
"packetLoss": "0"
}
]