HTTPS is a secure communication protocol based on HTTP and encrypted by using SSL. You can configure Link SDK for C to connect devices that use the HTTPS protocol with IoT Platform.

Process

The application program calls the API operations of Link SDK for C to connect with IoT Platform over HTTPS.

The following figure shows the process. In this example, the ./demos/http_basic_demo.c application program is used.

Process of an HTTP connection

For more information about HTTPS connection-specific API operations, see aiot_http_api.h.

Usage notes

  • General description:
    • For more information about supported regions, see Limits.
    • Only the POST request method is supported.
    • Devices connected over HTTPS can send messages to IoT Platform. However, IoT Platform cannot send commands to the devices over HTTPS.

      If devices need to receive messages from IoT Platform, you can connect the devices to IoT Platform over MQTT. For more information, see Overview.

  • Device authentication:
    • The value of Content-Type in the HTTPS header of a device authentication request must be application/json.
    • The tokens returned for device authentication are valid for only seven days. After the tokens become invalid, you must obtain new tokens.
  • Message sending:
    • The value of Content-Type in the HTTPS header of a message sending request must be application/octet-stream.
    • The size of data that is sent by using an API operation cannot exceed 128 KB.
    • The format of the message sending request is https://iot-as-http.${regionID}.aliyuncs.com/topic/${topic}.
      Variable Description
      ${regionID} The ID of the region in which the device is connected to IoT Platform. For more information, see Regions and zones.
      ${topic} The HTTPS topic. You can specify an MQTT topic for this variable. The standards of HTTPS topics and MQTT topics are the same. For more information, see What is a topic?.

Examples