0

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.

lazyCoder
  • 2,544
  • 3
  • 22
  • 41
  • Please see https://github.com/Azure/azure-iot-sdk-node/issues/464 - unfortunately cancelling running jobs is not possible at the moment. – kartben May 27 '19 at 13:24
  • Thanks for the reply, If I schedule a job for 1hour and my device is not connected but now I want to send one more schedule on the same device so I requirement is to update(execution time also) that job or cancel that job for the next schedule in that 1hour interval, So I am not able to send a message in that 1 hour period how can I overcome this issue please suggest me – lazyCoder May 28 '19 at 04:21

0 Answers0