Getting information about tasks in the asynchronous task queue
Getting Background Task Progress
https://api.mobizon.com.br/service/Taskqueue/GetStatus
https://api.mobizon.com.br/service/Taskqueue/GetStatus
This method allows you to get the progress of a background task by its ID. Our service uses background tasks so that your processes do not have to wait for the completion of a long request in cases such as:
Parameter | Type | Description |
---|---|---|
id | integer | Identifier of the background task. |
Data array:
Field | Type | Description |
---|---|---|
progress | integer | Progress of the task on a scale from 0 to 100%. |
status | integer | Task status code: 0 – waiting to start; 1 – in progress; 2 – completed; 3 – rejected. |
Code | Description |
---|---|
0 | Background task progress successfully retrieved. |
2 | If the task with the specified identifier is not found. |
curl -X POST \
'https://api.mobizon.com.br/service/taskqueue/getStatus?output=json&api=v1&apiKey=KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK' \
-H 'cache-control: no-cache' \
-H 'content-type: application/x-www-form-urlencoded' \
-d 'id=123'
var data = "id=123";
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function () {
if (this.readyState === 4) {
console.log(this.responseText);
}
});
xhr.open("POST", "https://api.mobizon.com.br/service/taskqueue/getStatus?output=json&api=v1&apiKey=KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK");
xhr.setRequestHeader("content-type", "application/x-www-form-urlencoded");
xhr.setRequestHeader("cache-control", "no-cache");
xhr.send(data);
<?php
use Mobizon\MobizonApi;
$api = new MobizonApi('KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK', 'api.mobizon.com.br');
// API method call
if ($api->call(
'taskqueue',
'getStatus',
array(
//background task identifier
'id' => '123'
)
)
) {
// Getting the result of an API request
$result = $api->getData();
} else {
// An error occurred during execution. Error code and message text output
echo '[' . $api->getCode() . '] ' . $api->getMessage() . PHP_EOL;
}