Encrypted

The platform uses the AWS MQTT broker (AWS IoT). Users can refer to the AWS MQTT documentation to learn how to send data to the platform through the MQTT API. The AWS documentation provides sample programs in different programming languages for reference.

The following will use the data (FactoryA) set in the data format page as an example to illustrate.

Certificate and Key

In the example program, a certificate and an endpoint will be required, which can be found in the red circle in the upper right corner of the image below. Click on the "Certificate" to download the file. After zip file decompression, you will get the relevant certificate files and keys.

Topic

As shown in the purple circle in the above image, the topic for each data source will be unique and is composed of "{UserID}/{DataSource}". The UserID can be found on the MQTT API documentation page on the platform, as indicated by the grayed-out area in the image above. Each user has a unique UserID.

Data Body

Please refer to the "Request Body" section at the bottom of the above image, which is in JSON format. In this example, it is { 'PowerUsage': 0, 'Temperature': 0, 'Motor': 0, 'DutyManager': 'John Doe' }. This data is set on the data source page.

Use Curl

Here's a simple example, where you need to replace {endpoint}, {topic}, and {data} with the data provided by the platform. The format for {data} is "{ "PowerUsage": 0, "Temperature": 0, "Motor": 0, "DutyManager": "John Doe" }".

curl --tlsv1.2 \
    --cacert AmazonRootCA1.pem \
    --cert certificate.pem.crt \
    --key private.pem.key \
    --request POST \
    --data {data} \
    "https://{endpoint}:8443/topics/{topic}?qos=1"

Note: For IoT hardware, if the hardware or IC design manufacturer supports AWS MQTT, data can also be sent to the X-platform based on the documentation provided by the manufacturer.

Last updated