Updated on 2024-11-06 GMT+08:00

Using HTTPS For Access

Overview

Hypertext Transfer Protocol Secure (HTTPS) is a secure communication protocol that uses the SSL encryption over the HTTP protocol. It is supported by IoTDA.

Constraints

Item

Limit

Supported HTTP version

HTTP 1.0

HTTP 1.1

Supported HTTPS

The IoT platform supports only the HTTPS protocol. For details about how to download a certificate, see Certificates.

Supported TLS version

TLS 1.2

Maximum body length

1 MB

API specifications

For details, see Specifications.

Maximum number of child devices of which properties can be reported by a gateway at a time

50

API Calling

For details about the platform endpoint, see Platform Connection Information.

Use the endpoint of IoTDA and the HTTPS port number 443.

Communication Between HTTPS Devices and the Platform

When a device connects to the platform through HTTPS, HTTPS APIs are used for their communication. These APIs can be used for device authentication as well as message and property reporting.

Message Type

Description

Device authentication

Devices obtain access tokens.

Device reporting properties

Devices report property data in the format defined in the product model.

Device reporting messages

Devices report custom data to IoTDA, which then forwards reported messages to an application or other Huawei Cloud services for storage and processing.

Gateway reporting device properties in batches

A gateway reports property data of multiple child devices to the platform.

Service Flow

  1. Create a product on the IoTDA console or by calling the API for creating a product.
  2. Register a device on the IoTDA console or calling the API Creating a Device.
  3. Call the device authentication API to obtain the access token of the device.
    1. Enter device ID and secret, and obtain the timestamp and encrypted password.
    2. Edit the JSON authentication message body based on Table 1. Figure 2 is an example.
      Table 1 JSON authentication message body

      Item

      Content

      device_id

      Device ID.

      sign_type

      The recommended value is 0, indicating that the system does not check whether the message timestamp is the same as the platform time and only checks whether the password is correct.

      timestamp

      Timestamp, for example, 2024062602. Obtain the value based on the client ID in Figure 1.

      password

      Encrypted password, which is the value of Password in Figure 1.

      Figure 1 Client ID generator
      Figure 2 Obtaining the access token
    3. Obtain the access address by referring to Platform Connection Information, combine the access address into a URL by referring to Figure 2, and send the URL to obtain the access_token.
  4. The obtained access token can be used by devices to report messages and properties. The access token is in the message header. The following uses property reporting as an example.
    Figure 3 Reporting properties
    Figure 4 Reporting properties

HTTP APIs

The following table describes the platform APIs.

API Category

Function

API

Device authentication API

Authenticating a device

/v5/device-auth

Device message reporting API

Reporting a device message

/v5/devices/{device_id}/sys/messages/up

Device property reporting APIs

Reporting device properties

/v5/devices/{device_id}/sys/properties/report

Gateway reporting child device properties

/v5/devices/{device_id}/sys/gateway/sub-devices/properties/report