Contents
Delete Subject - Plugixa Exam
DELETE /plugixa-exam/v1/subjects/{id}
Move a subject to the trash. It stops appearing in reads and lists, except a list with view=trash.
Scope subjects:delete; the token’s user needs the subjects:delete permission.
Note. The id is not checked: an unknown id also answers
200with"deleted": true. A subject that still has live child subjects is refused; move or delete its children first.
Request
DELETE https://your-site.example/wp-json/plugixa-exam/v1/subjects/12
Path parameters
| Name | Type | Description |
|---|---|---|
id |
integer |
The subject’s id |
Responses
200 OK. The subject is in the trash.
{
"success": true,
"data": {
"deleted": true
}
}
| Field | Type | Meaning |
|---|---|---|
data.deleted |
boolean |
Always true |
Errors
| Status | Code | When |
|---|---|---|
409 |
plugixa_exam_has_children |
The subject has live child subjects. |
Plus the errors every endpoint can return.
Examples
curl -s -X DELETE "https://your-site.example/wp-json/plugixa-exam/v1/subjects/12" \
-H "Authorization: Bearer $PLUGIXA_EXAM_TOKEN"
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-exam/v1/subjects/12');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'DELETE',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('PLUGIXA_EXAM_TOKEN'),
],
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('https://your-site.example/wp-json/plugixa-exam/v1/subjects/12', {
method: 'DELETE',
headers: {
'Authorization': `Bearer ${process.env.PLUGIXA_EXAM_TOKEN}`,
},
});
const { data } = await response.json();
Quick Links
Share