1

I am trying to make IotHub api request from postman for creating job to invoke direct message on multiple iot devices, I am getting iothub-errorcode 504 Gateway timeout error.

Following steps i performed:

  1. Created IotHub account on Azure
  2. Created a new device
  3. Generate SAS token using this az iot hub generate-sas-token -n <iothubName> --du <duration>
  4. Configured newly created device with C# code which is on listening mode for method named "LockDoor".

Here I attached CURL from Postman.

curl --location --request PUT 'https://myiothuburl/jobs/v2/job25?api-version=2021-04-12'
--header 'Content-Type: application/json; charset=utf-8'
--header 'Authorization: SharedAccessSignature sr=&sig=&skn=iothubowner'
--header 'Host: myiothuburl'
--header 'Content-Length: 317'
--data-raw '{ "jobId": "job25", "type": "scheduleDeviceMethod", "cloudToDeviceMethod": { "methodName": "LockDoor", "payload": {}, "responseTimeoutInSeconds": 10 }, "queryCondition": "DeviceId IN ['myDeviceName']", "startTime": "2022-10-11T11:51:36+0000", "maxExecutionTimeInSeconds": 10 }'

I am following this link: https://learn.microsoft.com/en-us/azure/iot-hub/iot-hub-devguide-jobs#jobs-to-execute-direct-methods

I am trying to make request exactly shown in above link but seems like I am making any mistake in it. If there are any other suggestions, please feel free to share. Thanks.

Adeel
  • 21
  • 2
  • I figure out this issue, when ever we use direct invoke method, it accepts string and dictionary / json, but we we run the same direct invoke method using job it only accept dictionary objects in key value form. It will not accept payload in string – Adeel Dec 08 '22 at 10:57

0 Answers0