Contents
On this page

Get Report Preview - Plugixa Exam

GET /plugixa-exam/v1/analytics/{exam}/preview

Get the body of the emailed report as HTML, exactly as a report schedule would send it, for one exam or for all exams.

Scope reports:read; the token’s user needs the reports:view permission. Needs Plugixa Exam Pro with the Analytics app on in Plugixa Exam -> App Manager (it also needs the Notifications app); with it off, this route answers 404.

Request

GET https://your-site.example/wp-json/plugixa-exam/v1/analytics/7/preview

Path parameters

Name Type Description
exam integer The exam’s id, or 0 for the summary across all exams that a schedule without an exam sends

Responses

200 OK. data.html is the report body.

{
  "success": true,
  "data": {
    "html": "..."
  }
}
Field Type Meaning
data.html string The report body as HTML, with every value in it escaped. The admin shows it in a sandboxed frame

Errors

Plus the errors every endpoint can return.

Examples

curl -s "https://your-site.example/wp-json/plugixa-exam/v1/analytics/7/preview" \
  -H "Authorization: Bearer $PLUGIXA_EXAM_TOKEN"
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-exam/v1/analytics/7/preview');
curl_setopt_array($ch, [
    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/analytics/7/preview', {
  headers: {
    'Authorization': `Bearer ${process.env.PLUGIXA_EXAM_TOKEN}`,
  },
});
const { data } = await response.json();

Quick Links

Share