Data Subscription
Overview
An NA calls the Subscribing to Service Data of the IoT Platform API to notify the IoT platform of message push addresses and notification types, such as device service data and device alarms. For details about the subscription API, see the API reference document.
In the subscription scenario, the IoT platform is the client, and the NA is the server. The IoT platform calls the API of the NA and pushes messages to the NA. If the subscription callback URL is an HTTPS address, a CA certificate must be uploaded to the IoT platform. The CA certificate is provided by the NA. (For details on how to obtain the certificate, see Exporting a CA Certificate.) To load a CA certificate, choose , and click Certificate Management and Add in the Push Certificate area. For details, see Uploading a CA Certificate.
This topic describes how to call the subscription API based on the Java code sample of the API.
Procedure
- In the Eclipse, choose CALLBACK_BASE_URL, and enter the callback URL and port number.
, modify
In the same application, the callback URL and port number of all subscription types must be the same. Subscription Test of the Developer Center checks the validity and connectivity of callback URLs.
- In the Eclipse, choose SubscribeServiceNotification.java, and choose .
, right-click
- View the response log on the console. If all types of subscriptions receive "201 Created" response, the subscription is successful.
NOTE:
- To modify the callback URL, change the value of CALLBACK_BASE_URL in the Constants.java file and run
SubscribeServiceNotification.java. The new callback URL replaces the original one.
- After the subscription is complete, you can choose Northbound JAVA API Demo and refer to the operations in Data Reporting. to set up an NA to receive messages (for example, POST messages) pushed by the IoT platform. If you need to perform a local test on the callback function and view the callback content, use the class provided in the
- To modify the callback URL, change the value of CALLBACK_BASE_URL in the Constants.java file and run
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot