Help Center > > FAQs> Secondary Development> FAQs About Application Development> Subscription and Push> Difference Between deviceDatachanged and deviceDataschanged

Difference Between deviceDatachanged and deviceDataschanged

Updated at: Jun 26, 2019 GMT+08:00

Device change data is subscribed to over the Device Data Change and Batch Device Data Change APIs, and the format for encapsulating data is different.

For example: A water meter has two service types: Battery and Connectivity. The data of the two services is reported each time.
  • If deviceDatachanged is subscribed to, the IoT platform pushes the data to the application server twice, Battery service data for the first time, and Connectivity service data for the second time. Examples are as follows:
    { "notifyType": "deviceDataChanged", "deviceId": "70a8d7cd-5ecd-4bda-a87c-afc16bd31bda", "gatewayId": "70a8d7cd-5ecd-4bda-a87c-afc16bd31bda", "requestId": null, "service": { "serviceId": "battery", "serviceType": "battery", "data": {"batteryLevel": 66}, "eventTime": "20170211T034003Z" }}
    {"notifyType": "deviceDataChanged","deviceId": "70a8d7cd-5ecd-4bda-a87c-afc16bd31bda", "gatewayId": "70a8d7cd-5ecd-4bda-a87c-afc16bd31bda","requestId": null, "service": { "serviceId": "Connectivity", "serviceType": "Connectivity", "data": { "signalStrength": 72, "cellId": 4022250974, "tac": 61374, "mnc": 91, "mcc": 235 }, "eventTime": "20170211T092317Z" }}
  • If deviceDataschanged is subscribed to, the IoT platform encapsulates the data of the two services together and sends the data to the application server.
    { "notifyType": "deviceDatasChanged", "requestId": null, "deviceId": "70a8d7cd-5ecd-4bda-a87c-afc16bd31bda",<br> "gatewayId": "70a8d7cd-5ecd-4bda-a87c-afc16bd31bda",<br> "services": [{ "serviceId": "battery", "serviceType": "battery", "data": { "batteryLevel": 66 }, "eventTime": "20170211T034003Z" }, { "serviceId": "Connectivity", "serviceType": "Connectivity","data": {"signalStrength": 72, "cellId": 4022250974, "tac": 61374, "mnc": 91, "mcc": 235 }, "eventTime": "20170211T034003Z" } ]}

Did you find this page helpful?

Submit successfully!

Thank you for your feedback. Your feedback helps make our documentation better.

Failed to submit the feedback. Please try again later.

Which of the following issues have you encountered?







Please complete at least one feedback item.

Content most length 200 character

Content is empty.

OK Cancel