Gridsense Docs iconGridsense Docs

Authentication

API details

  • Host: api.gridsense.cloud

Reading data

  • GET https://api.gridsense.cloud/v1/readers/<organization>/channels/<channel>/messages[?offset=0][&limit=10]
  • Headers
    • Authorization: Client <device secret>
  • Query parameters:
    • subtopic
    • offset
    • limit

Where <organization> and <channel> are the IDs of the organization and channel respectively. Unlike other endpoints and APIs, routes can NOT be used here.

Sending messages

  • POST https://api.gridsense.cloud/http/m/<organization>/c/<channel>
  • Body: message data
  • Headers
    • Authorization: Client <device secret>
    • Content-Type: application/senml+json

Where <organization> and <channel> are the IDs of the organization and channel respectively. Alternatively, the routes can be used instead.

Examples

You can use curl to send HTTP requests like so:

# Read data from a specific channel
curl 'https://api.gridsense.cloud/v1/readers/<organization>/channels/<channel>/messages?limit=10&offset=0' \
  --header 'Authorization: Client <device secret>'

# Batch publish two messages, in SenML format, to a specific channel
curl https://api.gridsense.cloud/http/m/<organization>/c/<channel> \
  --request POST \
  --header 'Content-Type: application/senml+json' \
  --header 'Authorization: Client <device secret>' \
  --data '[
  {
    "bn": "org/lighting/SmartLight/",
    "n": "brightness",
    "u": "lm",
    "v": 100
  },
  {
    "n": "power",
    "u": "W",
    "v": 150
  }
]'

On this page