Skip to main content

Use APIs to Cancel Abnormal Tasks

Background

On the Admin Settings -- Task Management page, administrators can manually cancel most types of tasks. However, some task types do not have a Cancel button, which is already in the optimization plan. Examples include file import and export, dataset preview, Webservice, account dataset update, and enhanced analysis update. If these tasks block the system and cause abnormalities, administrator users can temporarily use APIs to cancel abnormal tasks.

Implementation

Obtain the abnormal task taskID and account token

Log in to BI with an administrator account, enter Task Management, press F12, or right-click the page and select Inspect to open developer tools. In BI, filter task type and time range. In developer tools, go to Network -- Preview to find the taskID of the task to cancel. In Headers, find the account token information, and take the long string after uIdToken= up to the first semicolon. An example is shown below:

image.png

Note

Both taskID and account token can be obtained by calling APIs through Postman, which this article does not cover. In emergencies, developer tools are faster and more efficient.

Use Postman to call the API and delete the task

Request method: Post

Request URL: $home_url/api/task/{taskId}/cancel

Parameter description:

NameLocationTypeMeaningRequiredRemarks
taskIdURLStringTask IDYesObtained from developer tools
tokenHeadersStringAccount sync tokenYesObtained from developer tools or by calling $home_url/public-api/sign-in

Example:

image.png