I am using Azure IoT Hub schedule jobs for controlling the device from backend, I schedule the job for a specific duration and receive at the end of the device and that's how I am controlling my device with Azure IoT Hub.
Now the case I faced that I did the scheduled job for half an hour by mistake to my offline device now I want to delete the scheduled job for my requirement. I referred the documentation and tried for the schedule job id as the status of schedule is running
, So when I am hitting below REST
DELETE https://fully-qualified-iothubname.azure-devices.net/jobs/{id}?api-version=2018-06-30
I am getting below response:
{
"Message": "ErrorCode:OperationNotAllowedInCurrentState;Error: 405 ErrorCode: OperationNotAllowedInCurrentState\r\nMessage: \r\nTimestamp: XXXXXXXXXX\r\nTracking ID: \r\nPublic Message: Job cannot be cancelled in 'Running' status.\r\nPublic Info: null\r\nException: Microsoft.Azure.Devices.Common.Core.Exceptions.IotHubException ---> Microsoft.Azure.Devices.DeviceManagement.JobService.Thrift.Contract.JobServiceException: Exception of type 'Microsoft.Azure.Devices.DeviceManagement.JobService.Thrift.Contract.JobServiceException' was thrown.\r\n --- End of inner exception stack trace ---",
"ExceptionMessage": "Tracking ID:XXXXXXXX"
}
I want to delete or complete the schedule job in running state, please help me, if there is another way to do it then suggest me.