Contents
On this page

Get Question Passage - Plugixa Exam

GET /plugixa-exam/v1/passages/link/{question}

Get the id of the passage a question is linked to.

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:view permission.

Needs Plugixa Exam Pro, with the Passages app on in Plugixa Exam -> App Manager.

Note. The question id is not checked: an unknown question answers 200 with "passage_id": 0, the same as a question with no passage.

Request

GET https://your-site.example/wp-json/plugixa-exam/v1/passages/link/48

Path parameters

Name Type Description
question integer The question’s id

Responses

200 OK. data holds the linked passage’s id.

{
  "success": true,
  "data": {
    "passage_id": 7
  }
}
Field Type Meaning
data.passage_id integer The linked passage’s id, or 0 when there is none

Read the passage itself with Get Passage.

Errors

Plus the errors every endpoint can return.

Examples

curl -s "https://your-site.example/wp-json/plugixa-exam/v1/passages/link/48" \
  -u "$WP_USER:$WP_APP_PASSWORD"
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-exam/v1/passages/link/48');
curl_setopt_array($ch, [
    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/passages/link/48', {
  headers: {
    'Authorization': 'Basic ' + btoa(`${process.env.WP_USER}:${process.env.WP_APP_PASSWORD}`),
  },
});
const { data } = await response.json();

Quick Links

Share