0% found this document useful (0 votes)
9 views5 pages

SenseCAP Data OpenStream API Guide

The SenseCAP API document provides a quickstart guide for using the Data OpenStream API to subscribe to device messages and send commands using Eclipse Mosquitto. It includes instructions for setting up Mosquitto, obtaining access credentials, and subscribing to messages from devices. Users can monitor specific data by subscribing to particular keys associated with their devices.

Uploaded by

alan
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views5 pages

SenseCAP Data OpenStream API Guide

The SenseCAP API document provides a quickstart guide for using the Data OpenStream API to subscribe to device messages and send commands using Eclipse Mosquitto. It includes instructions for setting up Mosquitto, obtaining access credentials, and subscribing to messages from devices. Users can monitor specific data by subscribing to particular keys associated with their devices.

Uploaded by

alan
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

10/7/25, 4:00 p.m.

SenseCAP API Document

SenseCAP Document Center ([Link])


Search

Introduction ▾

HTTP API ▾

HTTP API Reference ▾

Data OpenStream API ▴

Data OpenStream API Quickstart (data_openstream_quickstart.html)

Data OpenStream API Reference (data_openstream_reference.html)

SenseCAP SDK ▾

Appendix ▾

 PDF Download

Data OpenStream API Quickstart


Summary:
This guide will walk you through how to subscribe your devices’ messages as well as how to send a
command to a specific device, using Eclipse Mosquitto’s CLIs to subscribe or publish messages.

Table of Contents
Setup

Credentials
[Link] 1/5
10/7/25, 4:00 p.m. SenseCAP API Document

Receive Devices’ Messages 

Subscribe a Specific Key

Setup
Install or download Mosquitto.

Credentials
Browse SenseCAP Portal, navigate to “Security/Access API keys”, click the “Create Access Key”, and

you can get the “Access API keys”, set down it as <Password>, and also “Organization ID” as <OrgID>.

[Link] 2/5
10/7/25, 4:00 p.m. SenseCAP API Document

Receive Devices’ Messages


Let’s listen for all of your devices’ messages.

[Link] a terminal window and execute the following command.

[Link] 3/5
10/7/25, 4:00 p.m. SenseCAP API Document

OrgID = Organization ID

Password = Access API keys

mosquitto_sub \
-h [Link] \
-t '/device_sensor_data/<OrgID>/+/+/+/+' \
-u 'org-<OrgID>' \
-P '<Password>' \
-I 'org-<OrgID>-quickstart' \
-v

Please replace the Organization ID and Access API Key you just obtained with the <OrgID> and

<Password> above.

[Link] up devices, while devices keep sending messages, you should receive the data like:

/device_sensor_data/1234/2CF7F12000000001/1/vs/4105 {"value":2,"timestamp":1544151824139}
/device_sensor_data/xxxx/2CF7F12XXXXXXXXX/1/vs/4097 {"value":23,"timestamp":1544151900992}
/device_sensor_data/xxxx/2CF7F12XXXXXXXXX/1/vs/4101 {"value":101629,"timestamp":1544151901112}
/device_sensor_data/xxxx/2CF7F12XXXXXXXXX/1/vs/4098 {"value":71,"timestamp":1544151900992}
/device_sensor_data/xxxx/2CF7F12XXXXXXXXX/1/vs/4099 {"value":69.12,"timestamp":1544151902224}
/device_sensor_data/xxxx/2CF7F12XXXXXXXXX/1/vs/4100 {"value":437,"timestamp":1544151922137}

example field description

1234 OrgId Organization ID

2CF7F12000000001 DeviceEUI Unique identification of device

1 Channel A physical socket on the device for a


sensor to be connected

vs Reserved The reserved field

4105 MeasureID The type of measurement, 4105 is the


Wind Speed

2 value Collected measurements, the Wind


Speed is 2m/s

1544151824139 timestamp The collection timestamp of the data

[Link] 4/5
10/7/25, 4:00 p.m. SenseCAP API Document

Subscribe a Specific Key


Specifying a specific key enables you to subscribe to data for a particular device or channel.

Example:

Subscribe to the temperature value collected by the Air Temperature and Humidity Sensor (DeviceEUI:
2CF7F12210400083;Channel: 1;).The temperature measurement ID is 4097.
Replace <OrgID> as Organization ID, <Password> as Access API Key, execute the command:

mosquitto_sub \
-h [Link] \
-t '/device_sensor_data/<OrgID>/2CF7F12210400083/1/vs/4097' \
-u 'org-<OrgID>' \
-P '<Password>' \
-I 'org-<OrgID>-quickstart' \
-v

Received the data:

/device_sensor_data/521853156991/2CF7F12210400083/1/vs/4097 {"value":28,"timestamp":1561373812
474}

Congratulations! Now you know how to monitor and receive messages via MQTT. Go build something

awesome!

© 2008-2023 Seeed Technology Co.,Ltd. All rights reserved.

[Link] 5/5

You might also like