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:
- Created IotHub account on Azure
- Created a new device
- Generate SAS token using this
az iot hub generate-sas-token -n <iothubName> --du <duration>
- 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.