Tag multiple SIMs using the REST API

Tagging SIMs via the Dashboard is a great option if you are only doing so for a handful of devices, but what if you want to tag dozens, hundreds, or even thousands of devices? For this we recommend using our REST API. This option lets you programmatically tag devices.

Note:If you aren't familiar with APIs, we highly recommend checking out our Introduction to Hologram's REST API guide as well as using Postman to make the API calls mentioned in this guide.

All API requests require your API Key to be included in the header, which is detailed in the introduction guide. For brevity's sake, this guide does not include the header information.

The first step to bulk tagging SIMs via the REST API is creating the tag. This can be done with the following endpoint:

POST https://dashboard.hologram.io/api/1/devices/tags

Body

{"name":"YOUR_TAG_NAME"}

If this tag is for a custom organization make sure to add: orgid=YOUR_ORG_ID  to the end of that endpoint.

This endpoint will return a success message with your tag's ID. Make sure to write this down as we will need it later.

{
"success": true,
"data": {
"tags": [
{
"name": "New tag",
"id": YOUR_TAG_ID,
"deviceids": []
}
]
}
}
 

If you already have a tag you wish to use you can look up its tag id with this endpoint:

GET https://dashboard.hologram.io/api/1/devices/tags

Now that we have the tag ID we need to get the list of Device ID's for the devices we want to tag. This can be done by exporting your device list as a CSV. However, to be consistent, we will get this information via the REST API using this call:

GET https://dashboard.hologram.io/api/1/devices
Screen_Shot_2019-10-22_at_19.59.43.png

 

Once we have the Device IDs of all the devices we want to tag we simply have to do the tagging which is done with the following call:

POST https://dashboard.hologram.io/api/1/devices/tags/{YOUR_TAG_ID}/link/

Body

{"deviceids":[DEVICE_ID_1, DEVICE_ID_2, DEVICE_ID_N]}

 

Was this article helpful?
0 out of 0 found this helpful