Get devices that own a variable

This request will retrieve the "device" attribute from all variables that are labeled a specific label <targetLabel>.

The below request uses:

  • Dynamic fields: To only retrieve the "device" attribute from the variable that comply with the filter
  • String filter: label=<targetLabel>
curl -X GET 'https://industrial.api.ubidots.com/v2.0/variables/?fields=devices&label=<targetVariable>' \
-H 'X-Auth-Token: <TOKEN>'

Response:

{
  "count": 2,
  "next": null,
  "previous": null,
  "results": [
    {
      "device": {
        "url": "https://industrial.ubidots.com/api/v2.0/devices/662671438b922f6e51876871",
        "id": "662671438b922f6e51876871",
        "label": "apply-watermonkeyv3-test",
        "name": "Apply watermonkeyv3 test",
        "createdAt": "2024-04-22T14:16:35.765622Z"
      }
    },
    {
      "device": {
        "url": "https://industrial.ubidots.com/api/v2.0/devices/66048fa268228216e2338638",
        "id": "66048fa268228216e2338638",
        "label": "demo206",
        "name": "Demo 206",
        "createdAt": "2024-03-27T21:29:06.432113Z"
      }
    }
  ]
}