Contents
On this page

Reorder Subjects - Plugixa Exam

POST /plugixa-exam/v1/subjects/reorder

Set the position of subjects among their siblings, in the order you list them.

Scope subjects:write; the token’s user needs the subjects:edit permission.

Request

POST https://your-site.example/wp-json/plugixa-exam/v1/subjects/reorder

Request body

Content type: application/json

Field Type Required Description
ids integer[] Yes Subject ids in the order you want them. The first gets ordering 1, the second 2, and so on.

Send the children of one parent at a time. The ids are not checked: an unknown id is skipped silently, and ids from different parents are numbered in one sequence all the same. Reordering never moves a subject to another parent: for that, use Update Subject.

{
  "ids": [15, 12, 18]
}

Responses

200 OK. The new order is saved.

{
  "success": true,
  "data": {
    "reordered": true
  }
}
Field Type Meaning
data.reordered boolean Always true

Errors

Status Code When
400 rest_missing_callback_param ids is missing.
400 rest_invalid_param ids is not an array of integers.

Plus the errors every endpoint can return.

Examples

curl -s -X POST "https://your-site.example/wp-json/plugixa-exam/v1/subjects/reorder" \
  -H "Authorization: Bearer $PLUGIXA_EXAM_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"ids":[15,12,18]}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-exam/v1/subjects/reorder');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST  => 'POST',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER     => [
        'Authorization: Bearer ' . getenv('PLUGIXA_EXAM_TOKEN'),
        'Content-Type: application/json',
    ],
    CURLOPT_POSTFIELDS     => json_encode([
        'ids' => [15, 12, 18],
    ]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('https://your-site.example/wp-json/plugixa-exam/v1/subjects/reorder', {
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${process.env.PLUGIXA_EXAM_TOKEN}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ ids: [15, 12, 18] }),
});
const { data } = await response.json();

Quick Links

Share