How to use postman to test send data to iot central

Feiling Pan 40 Reputation points
2023-06-12T21:59:49.48+00:00

I don't know how to operate, maybe it needs middleware or something else, I have tried to use function and so on as middleware delivery, but it doesn't seem to work. I wish someone could teach me step by step. I've been doing this for a long time.

Azure IoT Central
Azure IoT Central
An Azure hosted internet of things (IoT) application platform.
376 questions
{count} votes

Accepted answer
  1. Roman Kiss 2,246 Reputation points
    2023-06-13T08:41:34.6066667+00:00

    Hi @Feiling Pan ,

    Azure IoT Hub allows to send an event (device telemetry data) via the REST POST request, see more details here.

    In the case of Azure IoT Central, you have to obtain a fully-qualified-iothubname its underlying Azure IoT Hub (cluster) using a DPS service, for instance using the Azure portal CLI commands.

    The following are steps to get the assignedHub and the device sas token:

    Getting the assignedHub:

    az iot device registration create --id-scope {id_scope} --rid {device_id} --key {symmetric_key}

    Getting the device sas token:

    az iot hub generate-sas-token --connection-string 'HostName={assignedHub};DeviceId={device_id};SharedAccessKey={symmetric_key}'

    Once you have the assignedHub and the device sas token, you can use the Postman for sending the telemetry data to the Azure IoT Central its underlying assignedHub:

    https://{assignedHub}/devices/{device_id}/messages/events?api-version=2021-04-12

    Authorization:{sas}

    Note, that the values of id_scope, device_id and symetric_key are from your Azure IoT Central App.

    Also, you can create an Azure function to replace the above steps, see more details here.

    Thanks

    Roman

    1 person found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. Dominic 1,631 Reputation points Microsoft Employee
    2023-06-13T05:53:45.6833333+00:00

    There are multiple guides and a sample Postman file that illustrate most of the IoT Central REST API here:

    There's a link to download the Postman collection in each of these articles.

    1 person found this answer helpful.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.