4.3.8. TaskStop¶
Description¶
The method allows you to stop a task by its task_ids.
The stopped task gets the Canceled status and is placed in the Incomplete tasks block on the Dashboard page.
Attention
Running status.Scheduled, Explore, Completed, Rejected, Canceled, Stalled — stopping is not possible because the task has not yet started, has already completed, or has completed unsuccessfully.Request¶
{
"user_id":(number),
"methods":[
{
"method":"TaskStop",
"params":{
"project_id":(number),
"task_ids":' id1 | [id1,id2] '
}
}
]
}
where:
user_id— an integer value, a user identifier;project_id— an integer value, a user project identifier;task_ids— task identifiers, the field can be specified in one of the following formats:id1— an integer value, a task identifier;[id1,id2]— an array of integer values, task identifiers.
Reply¶
{
"reply":[
{
"method":"TaskStop",
"result":[
{
"task_id":(number),
"status":"Stop request was sent"
}
]
}
]
}
where:
task_id— an integer value, a task identifier;status— a string, the valueStop request was sentmeans that the command to stop the task was successfully sent;error— a string, the valueStopping task is unavailablereturns for tasks not yet started or for successfully and unsuccessfully completed tasks (see statuses:Scheduled,Explore,Completed,Rejected,Canceled,Stalled).
Example¶
cURL utility¶ #1. A simple request to stop a single task.
curl http://172.16.1.41/ctrl_api/v1/json \
-H "Content-Type: application/json" \
--data '{"user_id":1,"methods":[{"method":"TaskStop","params":{"project_id":2,"task_ids":63}}]}'
#2. Request to stop multiple tasks.
curl http://172.16.1.41/ctrl_api/v1/json \
-H "Content-Type: application/json" \
--data '{"user_id":1,"methods":[{"method":"TaskStop","params":{"project_id":2,"task_ids":[64,65]}}]}'
#3. A request to stop multiple tasks. The third task has a non-existent value specified in the task_ids field.
curl http://172.16.1.41/ctrl_api/v1/json \
-H "Content-Type: application/json" \
--data '{"user_id":1,"methods":[{"method":"TaskStop","params":{"project_id":2,"task_ids":[66,67,68]}}]}'
{
"reply": [
{
"method": "TaskStop",
"result": [
{
"task_id": 63,
"status": "Stop request was sent"
}
]
}
]
}
{
"reply": [
{
"method": "TaskStop",
"result": [
{
"task_id": 64,
"status": "Stop request was sent"
},
{
"task_id": 65,
"status": "Stop request was sent"
}
]
}
]
}
{
"reply": [
{
"method": "TaskStop",
"result": [
{
"task_id": 66,
"status": "Stop request was sent"
},
{
"task_id": 67,
"status": "Stop request was sent"
},
{
"task_id": 68,
"error": "Stopping task is unavailable"
}
]
}
]
}