Delete Task
DELETE /v1/nexttask/tasks/{id}
Delete a task
Deletes a task and its subtasks. It can be restored for 7 days. Needs Tasks > Delete.
Request
DELETE https://your-site.example/api/index.php/v1/nexttask/tasks/{id}
Parameters
| Name | Type | In | Required | Description |
|---|---|---|---|---|
id |
integer |
path |
Yes | The record the call is about. An id or ids in the body is ignored. |
Responses
200 — The ids deleted.
{
"success": true,
"message": "string",
"messages": "string",
"data": {
"deleted": [
1
]
}
}
Errors
| Status | Code | When |
|---|---|---|
401 |
No valid API token. | |
403 |
FORBIDDEN when the role or the list does not allow it, APP_DISABLED when the feature's app is off. |
|
404 |
NOT_FOUND: no such record, or not one you can reach. |
Examples
curl
curl -s -X DELETE "https://your-site.example/api/index.php/v1/nexttask/tasks/1" \
-H "X-Joomla-Token: $API_TOKEN"
PHP
<?php
$ch = curl_init('https://your-site.example/api/index.php/v1/nexttask/tasks/1');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'DELETE',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'X-Joomla-Token: ' . getenv('API_TOKEN'),
],
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
JavaScript
const API_TOKEN = process.env.API_TOKEN;
const response = await fetch("https://your-site.example/api/index.php/v1/nexttask/tasks/1", {
method: 'DELETE',
headers: {
"X-Joomla-Token": `${API_TOKEN}`,
},
});
const data = await response.json();