AnsweredAssumed Answered

How to query task status if you do not know taskId ?

Question asked by dl0055113 on Feb 20, 2018
Latest reply on Feb 22, 2018 by dl0055113

where can i obtain the 'taskId' when I submit a course copy or a course deletion from the API?


I am able to submit both course copy and course deletion API calls using these API endpoints:

POST /learn/api/public/v1/courses/{courseId}/copy

DELETE /learn/api/public/v1/courses/{courseId}


But I have no idea how to query the resulting TASK, to see if/when it completes or what state it is in using this endpoint (below)... where does one find the resutling 'taskId' so that I can query this endpoint to obtain the STATUS of the task?


GET /learn/api/public/v1/courses/{courseId}/tasks/{taskId}

Implementation Notes

Check the status of a queued task associated with a Course. Returns 200 unless task is complete. If task is complete this endpoint will return a 303 redirect to the GET Course endpoint. Statistical data shows that the average copy task duration is under a second. However, very large courses can take several minutes. Also important to note is that these background tasks can potentially be queued behind other system tasks therefore prolonging the time a task stays in the Queued status. We recommend that this endpoint be polled every 60 seconds while waiting for a Course copy to complete.Users with entitlements 'system.course.copy.EXECUTE' can view the task status.Since: 3300.0.0


Response Class (Status 200)


CourseTask {
id (string, read only): The ID of this task. ,status (string, read only): The status of the task. Possible values for status are:
  • Queued
  • Assigned
  • Running
  • Complete
  • CompleteWithErrors
  • Incomplete Queued is the initial state of a task.
= ['Waiting', 'Assigned', 'Running', 'Complete', 'CompleteErrors', 'Incomplete'],percentComplete (integer, read only):

Task progress, with 0 representing not started and 100 representing done.

,started (string, read only):

The date the task was started.