...
Create and configure the gateway if you haven't already.
Create devices if you haven't already.
Use the gateway to publish telemetry events and update a device's configuration.
...
Callers can use one of three tokens to send requests:
The Token token obtained by clicking the API Keys keys button (key icon) at the top-right of the Registry Details details page (referred to subsequently as Registry Tokenregistry token).
The gateway's JWT.
The device's JWT.
Using the Registry Token registry token or gateway's JWT:
curl -X POST -H 'ClearBlade-UserToken: GATEWAY_JWT_OR_REGISTRY_TOKEN' -H 'Content-Type: application/json' --data '{"binaryData": BASE64_ENCODED_STRING, "gatewayInfo": {"delegatedDeviceId": "device-id"}}' 'https://us-central1.clearblade.com/api/v/4/webhook/execute/baa6bab40cb6959087ada3f0e9f401/cloudiotdevice_devices?name=URL_ENCODED_GATEWAY_NAME&method=publishEvent'
Using the Registry Token registry token or device's JWT:
curl -X POST -H 'ClearBlade-UserToken: DEVICE_JWT_OR_REGISTRY_TOKEN' -H 'Content-Type: application/json' --data '{"binaryData": BASE64_ENCODED_STRING, "gatewayInfo": {"gatewayId": "gateway-id"}}' 'https://us-central1.clearblade.com/api/v/4/webhook/execute/baa6bab40cb6959087ada3f0e9f401/cloudiotdevice_devices?name=URL_ENCODED_DEVICE_NAME&method=publishEvent'
Telemetry events are forwarded to a Cloud Pub/Sub topic, as specified in the console or with the eventNotificationConfigs[i].pubsubTopicName
field in the device registry resource. The publishEvent
method provides an optional subFolder
field for classifying telemetry events. To learn how to publish data from subfolders to separate Pub/Sub topics, see using the HTTP bridge.
Updating device configuration through the gateway
...
To get the device configuration currently available from ClearBlade IoT Core, use a getConfig
request. You can include the JWT from the gateway or the authorization bearer header’s device.
Using the Registry Token registry token or gateway's JWT:
curl -X GET -H 'ClearBlade-UserToken: GATEWAY_JWT_OR_REGISTRY_TOKEN' 'https://us-central1.clearblade.com/api/v/4/webhook/execute/baa6bab40cb6959087ada3f0e9f401/cloudiotdevice_devices?name=URL_ENCODED_GATEWAY_NAME&localVersion=0&gatewayInfo.delegatedDeviceId=DEVICE_ID'
Using the Registry Token registry token or device's JWT:
curl -X GET -H 'ClearBlade-UserToken: DEVICE_JWT_OR_REGISTRY_TOKEN' 'https://us-central1.clearblade.com/api/v/4/webhook/execute/baa6bab40cb6959087ada3f0e9f401/cloudiotdevice_devices?name=URL_ENCODED_DEVICE_NAME&localVersion=0&gatewayInfo.gatewayId=GATEWAY_ID'
...
Use a setState
request to report the device state to ClearBlade IoT Core. State data must be base64-encoded. You can include the JWT from the gateway or the device in the authorization bearer header.
Using the Registry Token registry token or gateway's JWT:
curl -X POST -H 'ClearBlade-UserToken: GATEWAY_JWT_OR_REGISTRY_TOKEN' -H 'Content-Type: application/json' --data '{"state": {"binaryData": BASE64_ENCODED_STRING}, "gatewayInfo": {"delegatedDeviceId": "device-id"}}' 'https://us-central1.clearblade.com/api/v/4/webhook/execute/baa6bab40cb6959087ada3f0e9f401/cloudiotdevice_devices?name=URL_ENCODED_GATEWAY_NAME&method=setState'
Using the Registry Token registry token or device's JWT:
curl -X POST -H 'ClearBlade-UserToken: DEVICE_JWT_OR_REGISTRY_TOKEN' -H 'Content-Type: application/json' --data '{"state": {"binaryData": BASE64_ENCODED_STRING}, "gatewayInfo": {"gatewayId": "gateway-id"}}' 'https://us-central1.clearblade.com/api/v/4/webhook/execute/baa6bab40cb6959087ada3f0e9f401/cloudiotdevice_devices?name=URL_ENCODED_DEVICE_NAME&method=setState'
...
View the Cloud console’s device details or use the API to retrieve device state data. For more information, see Getting device state data.