Contents
On this page
Restore Question Version - Plugixa Exam
POST /plugixa-exam/v1/questions/{id}/restore/{version}
Put an earlier version’s content back on a question. The restore is saved as a new version, so the history keeps every step.
Not reachable with an API token: since 1.4.1 a token request to this route answers 403 plugixa_exam_token_route. Call it as a signed-in WordPress user (from a script, with an Application Password) who holds the questions:edit permission. questions:edit.own is not enough here, even on the user’s own questions. It needs Plugixa Exam Pro with the Version history app on in Plugixa Exam -> App Manager: with the app off, the route answers 404.
From the saved version, the restore takes the title, stem, explanation, answer_key, rubric and the options. The question’s type, subject, difficulty, default points, option shuffling and published status stay as they are now. The question then gets a new version number, one higher than its current one.
Note. The restored option list replaces the current one, the way
optionsdoes on Update Question: options added since that version are deleted.
Request
POST https://your-site.example/wp-json/plugixa-exam/v1/questions/12/restore/1
No request body.
Path parameters
| Name | Type | Description |
|---|---|---|
id |
integer |
The question’s id |
version |
integer |
The version number to restore. It must be in the question’s history and must not be its current version |
Responses
200 OK. data is the question after the restore.
{
"success": true,
"data": {
"id": 12,
"subject_id": 4,
"question_type": "mcq_single",
"title": "Capital city of France",
"slug": "capital-of-france",
"stem": "<p>What is the capital of France?</p>",
"difficulty": 2,
"default_points": 1,
"answer_key": { "negative_marking": false, "min_score": 0 },
"explanation": "",
"shuffle_options": true,
"published": true,
"version": 4,
"approval_status": "approved",
"rubric": null,
"custom_fields": null,
"render_hint": null,
"created_at": "2026-11-10 14:05:00",
"modified_at": "2026-11-12 09:30:00",
"created_by": 1,
"modified_by": 1,
"deleted_at": null,
"options": [
{ "id": 41, "question_id": 12, "ordering": 1, "option_text": "Paris", "is_correct": true, "match_key": null, "feedback": null },
{ "id": 42, "question_id": 12, "ordering": 2, "option_text": "Lyon", "is_correct": false, "match_key": null, "feedback": null }
],
"tag_ids": [5, 8]
}
}
| Field | Type | Meaning |
|---|---|---|
data.version |
integer |
The new version number, holding the restored content |
data.title |
string |
The title from the restored version |
data.options |
object[] |
The options from the restored version |
data.published |
boolean |
Unchanged by the restore |
The other fields are as in Get Question.
Errors
| Status | Code | When |
|---|---|---|
404 |
plugixa_exam_not_found |
No question with that id. |
409 |
plugixa_exam_already_current |
version is the question’s current version. |
404 |
plugixa_exam_version_not_found |
version is not in the question’s history. |
400 |
The Update Question checks | The restored content does not pass the checks a question must pass, for example an option list that no longer suits the current type. |
Plus the errors every endpoint can return.
Examples
curl -s -X POST "https://your-site.example/wp-json/plugixa-exam/v1/questions/12/restore/1" \
-u "$WP_USER:$WP_APP_PASSWORD"
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-exam/v1/questions/12/restore/1');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Basic ' . base64_encode(getenv('WP_USER') . ':' . getenv('WP_APP_PASSWORD')),
],
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('https://your-site.example/wp-json/plugixa-exam/v1/questions/12/restore/1', {
method: 'POST',
headers: {
'Authorization': 'Basic ' + btoa(`${process.env.WP_USER}:${process.env.WP_APP_PASSWORD}`),
},
});
const { data } = await response.json();
Quick Links
Share