Magic resources are specials resources that start with $, and have some special behaviors, like trigger some common task, or update static data. These resources can be used as the others using read and write operations.

📘

Remember to replace THING_TOKEN with the thing token that you got when you activated your thing.

🚧

Magic resource handlers are processed asynchronously: mixing various magic resources in a single request may have an unexpected behavior because order might not be respected.

$geo resource

This resource allows the update of the current thing position in GeoJSON format.

GeoJSON and legacy [long, lat] pairs are accepted as valid input value, or you can use the geo attribute: the final value will be saved in GeoJSON format.

curl -H "Content-Type: application/json" \
       -d "... see below ..." \
       -X POST "http://api.thethings.io/v2/things/THING_TOKEN"

  {
    "values":
      [{
          "key": "$geo",
          "value" : {
                  "type": "Point",
                  "coordinates": [2.154007, 41.390205]
          }
        },
        // OR using legacy [long, lat]
        {
          "key": "$geo",
          "value" : [2.154007, 41.390205]
        },
        // OR using geo attribute object
        {
          "key": "$geo",
          "value" : null,
          "geo" : {
                  "lat": 41.390205,
                  "long": 2.154007
          }
        }]
  }

$settings resource

This resource allows the update of thing settings meta-data store. It also permits to set a single value at path (in dot separated format).

curl -H "Content-Type: application/json" \
       -d "... see below ..." \
       -X POST "http://api.thethings.io/v2/things/THING_TOKEN"

  {
    "values":
      [{
          "key": "$settings",
          "value" : {
                  "name": "My Thing",
                  "foo": "bar"
          }
        },
        // OR using path
        {
          "key": "$settings.name",
          "value" : "My Thing"
        }]
  }
Language
Click Try It! to start a request and see the response here!