This document will help you connect a device to a Zoho IoT application using HTTPS communication. For this demonstration, we will use POSTMAN as the https client to post messages to the application.
The steps for connecting a HTTPS device are listed below.
Create a device with HTTPS device connectivity and access the credentials of the created device.
Update credentials in your device and establish connection.
Creating a device with HTTPS device connectivity
For this illustration, we will create a device called "My HTTPS Device" in the application, using the TRB145 product. You can choose any device product that fits your requirements, but ensure that it supports HTTPS connectivity
You can also use your own custom device product to create a device. If you need help adding your product to the device gallery reach out to support@zohoiot.com. Access the End Application.
Select Devices > Devices in the left pane. Click Add Device. Select Add Using Product Gallery (Devices) and click Proceed. Select your desired product. Here, TRB145 is selected. Click Import and Proceed. Provide the required details in the appropriate fields and click Proceed. Make sure HTTPS is selected as the device connectivity.
Click View Device.
Click Actions > Connection Details. This will display the credentials required to establish connection with the Zoho IoT application.
Now that you have created your device and obtained its connection credentials, you can use these credentials to establish a secure connection with the application and start sending data.
You can use these credentials in your device application to establish a secure HTTPS connection. In this guide, we'll use Postman, a popular HTTPS client, to connect and send data. The fields required in Postman will mirror those needed in your device application.
Updating the Credentials and Sending Messages
To send messages using an HTTPS POST call, three key credentials are required: the Endpoint, Authentication Token, and Device ID. By combining these credentials, you can securely establish a connection with the device and transmit messages through the application.
There are two ways to configure credentials for the HTTPS POST function:
Using URL Parameters
Using Headers
Using URL Params
If you're using the HTTPS client with parameter-based authentication, you can easily include the credentials in the URL as parameters. The URL to be used can be found in the URL Parameter Implementation section, located under the Endpoint Usage tab.
Structure for URL with Parameters:
https://<telemetry_endpoint>/?device_id=<deviceid>&device-token=<authenticationtoken>
If you're using the Header option for authentication, you can input the following values: device_id and device_token from the Endpoints section as headers into the appropriate fields. In this implementation, the strings "device_id" and "device_token" are used as the keys, while their corresponding values are treated as the actual value.
The Endpoint URL is also available and can be included in the request as part of the connection setup. This ensures a complete configuration for successful authentication and communication with the device.
Send the message
Once the credentials are updated, you can begin sending the payload to the Zoho IoT application from the HTTPS client/device. For this illustration, a simple payload of {"temp": 20} is sent as a JSON object (recommended payload format) to the application.
View the Message
The message sent by the client/device can be viewed under the Messages > Historic Messages section on the device's information page.
Note: Refresh the page to view the latest messages, or use the Live Messages tab to listen to incoming messages in real time.
If you're having trouble connecting your device to the Zoho IoT application, please reach out to us at support@zohoiot.com for assistance.