Docs API reference
Quizzes (assessments)
Build quizzes from questions and pools.
An assessment belongs to a course version. Its items are either a pinned question version or a pool that draws random questions at attempt time.
9 endpoints · base path /api/v1
Change an item's points
AccessAdmin, or an API key with the write scope.
Sets pointsOverride (omit to use the question's own points) and, for pools, poolDrawCount.
Parameters
| Name | In | Type | Notes |
|---|---|---|---|
| idrequired | path | string (uuid) | The id from a previous response. |
Request body application/json · ItemUpdate
| Field | Type | Notes |
|---|---|---|
| pointsOverride | number | min 0 |
| poolDrawCount | integer (int32) | min 1 |
Example request body
{
"pointsOverride": 1.5,
"poolDrawCount": 1
}Responses
Errors
| Status | When |
|---|---|
| 400 | The request was malformed or failed validation. errors lists each field. |
| 401 | Missing, invalid or expired credentials. |
| 403 | Your credential is valid but isn't allowed to do this. |
| 404 | It doesn't exist, or it belongs to another tenant (the two look the same on purpose). |
Errors use RFC 9457 problem details.
ASSESSMENT_ITEM_ID=37386ae0-0ea5-44e0-a02e-161f807af560
curl -X PUT "$LMS_URL/api/v1/assessment-items/$ASSESSMENT_ITEM_ID" \
-H "X-API-Key: $LMS_KEY" \
-H "Content-Type: application/json" \
-d '{
"pointsOverride": 1.5,
"poolDrawCount": 1
}'const LMS_URL = process.env.LMS_URL
const LMS_KEY = process.env.LMS_KEY
const assessmentItemId = "37386ae0-0ea5-44e0-a02e-161f807af560"
const res = await fetch(`${LMS_URL}/api/v1/assessment-items/${assessmentItemId}`, {
method: 'PUT',
headers: { "X-API-Key": LMS_KEY, 'Content-Type': 'application/json' },
body: JSON.stringify({
"pointsOverride": 1.5,
"poolDrawCount": 1
}),
})
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`)const LMS_URL = process.env.LMS_URL!
const LMS_KEY = process.env.LMS_KEY!
const assessmentItemId = "37386ae0-0ea5-44e0-a02e-161f807af560"
const res = await fetch(`${LMS_URL}/api/v1/assessment-items/${assessmentItemId}`, {
method: 'PUT',
headers: { "X-API-Key": LMS_KEY, 'Content-Type': 'application/json' },
body: JSON.stringify({
"pointsOverride": 1.5,
"poolDrawCount": 1
}),
})
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`)import os
import requests
LMS_URL = os.environ["LMS_URL"]
HEADERS = {"X-API-Key": os.environ["LMS_KEY"]}
assessment_item_id = "37386ae0-0ea5-44e0-a02e-161f807af560"
res = requests.put(f"{LMS_URL}/api/v1/assessment-items/{assessment_item_id}", headers=HEADERS, json={
"pointsOverride": 1.5,
"poolDrawCount": 1,
}, timeout=10)
res.raise_for_status()import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Request {
public static void main(String[] args) throws Exception {
String lmsUrl = System.getenv("LMS_URL");
String lmsKey = System.getenv("LMS_KEY");
String assessmentItemId = "37386ae0-0ea5-44e0-a02e-161f807af560";
String body = """
{
"pointsOverride": 1.5,
"poolDrawCount": 1
}
""";
var request = HttpRequest.newBuilder(URI.create(lmsUrl + "/api/v1/assessment-items/" + assessmentItemId))
.header("X-API-Key", lmsKey)
.header("Content-Type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString(body))
.build();
var response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
if (response.statusCode() >= 300) throw new IllegalStateException(response.statusCode() + " " + response.body());
}
}require "net/http"
require "json"
lms_url = ENV.fetch("LMS_URL")
assessment_item_id = "37386ae0-0ea5-44e0-a02e-161f807af560"
uri = URI("#{lms_url}/api/v1/assessment-items/#{assessment_item_id}")
request = Net::HTTP::Put.new(uri, "X-API-Key" => ENV.fetch("LMS_KEY"), "Content-Type" => "application/json")
request.body = {
"pointsOverride" => 1.5,
"poolDrawCount" => 1,
}.to_json
response = Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == "https") { |http| http.request(request) }
raise "#{response.code} #{response.body}" unless response.is_a?(Net::HTTPSuccess)<?php
$lmsUrl = getenv('LMS_URL');
$assessmentItemId = "37386ae0-0ea5-44e0-a02e-161f807af560";
$ch = curl_init("$lmsUrl/api/v1/assessment-items/{$assessmentItemId}");
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'PUT',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['X-API-Key: ' . getenv('LMS_KEY'), 'Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode([
"pointsOverride" => 1.5,
"poolDrawCount" => 1,
]),
]);
$response = curl_exec($ch);
if (curl_getinfo($ch, CURLINFO_RESPONSE_CODE) >= 300) {
throw new RuntimeException($response);
}package main
import (
"fmt"
"io"
"net/http"
"os"
"strings"
)
func main() {
assessmentItemId := "37386ae0-0ea5-44e0-a02e-161f807af560"
body := strings.NewReader(`{
"pointsOverride": 1.5,
"poolDrawCount": 1
}`)
req, _ := http.NewRequest("PUT", os.Getenv("LMS_URL") + "/api/v1/assessment-items/" + assessmentItemId, body)
req.Header.Set("X-API-Key", os.Getenv("LMS_KEY"))
req.Header.Set("Content-Type", "application/json")
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
data, _ := io.ReadAll(res.Body)
if res.StatusCode >= 300 {
panic(fmt.Sprintf("%d %s", res.StatusCode, data))
}
_ = data
}Remove an item from a quiz
AccessAdmin, or an API key with the write scope.
Removes the item. Remaining items are renumbered.
Parameters
| Name | In | Type | Notes |
|---|---|---|---|
| idrequired | path | string (uuid) | The id from a previous response. |
Responses
Errors
| Status | When |
|---|---|
| 401 | Missing, invalid or expired credentials. |
| 403 | Your credential is valid but isn't allowed to do this. |
| 404 | It doesn't exist, or it belongs to another tenant (the two look the same on purpose). |
Errors use RFC 9457 problem details.
ASSESSMENT_ITEM_ID=37386ae0-0ea5-44e0-a02e-161f807af560
curl -X DELETE "$LMS_URL/api/v1/assessment-items/$ASSESSMENT_ITEM_ID" \
-H "X-API-Key: $LMS_KEY"const LMS_URL = process.env.LMS_URL
const LMS_KEY = process.env.LMS_KEY
const assessmentItemId = "37386ae0-0ea5-44e0-a02e-161f807af560"
const res = await fetch(`${LMS_URL}/api/v1/assessment-items/${assessmentItemId}`, {
method: 'DELETE',
headers: { "X-API-Key": LMS_KEY },
})
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`)const LMS_URL = process.env.LMS_URL!
const LMS_KEY = process.env.LMS_KEY!
const assessmentItemId = "37386ae0-0ea5-44e0-a02e-161f807af560"
const res = await fetch(`${LMS_URL}/api/v1/assessment-items/${assessmentItemId}`, {
method: 'DELETE',
headers: { "X-API-Key": LMS_KEY },
})
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`)import os
import requests
LMS_URL = os.environ["LMS_URL"]
HEADERS = {"X-API-Key": os.environ["LMS_KEY"]}
assessment_item_id = "37386ae0-0ea5-44e0-a02e-161f807af560"
res = requests.delete(f"{LMS_URL}/api/v1/assessment-items/{assessment_item_id}", headers=HEADERS, timeout=10)
res.raise_for_status()import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Request {
public static void main(String[] args) throws Exception {
String lmsUrl = System.getenv("LMS_URL");
String lmsKey = System.getenv("LMS_KEY");
String assessmentItemId = "37386ae0-0ea5-44e0-a02e-161f807af560";
var request = HttpRequest.newBuilder(URI.create(lmsUrl + "/api/v1/assessment-items/" + assessmentItemId))
.header("X-API-Key", lmsKey)
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
var response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
if (response.statusCode() >= 300) throw new IllegalStateException(response.statusCode() + " " + response.body());
}
}require "net/http"
require "json"
lms_url = ENV.fetch("LMS_URL")
assessment_item_id = "37386ae0-0ea5-44e0-a02e-161f807af560"
uri = URI("#{lms_url}/api/v1/assessment-items/#{assessment_item_id}")
request = Net::HTTP::Delete.new(uri, "X-API-Key" => ENV.fetch("LMS_KEY"))
response = Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == "https") { |http| http.request(request) }
raise "#{response.code} #{response.body}" unless response.is_a?(Net::HTTPSuccess)<?php
$lmsUrl = getenv('LMS_URL');
$assessmentItemId = "37386ae0-0ea5-44e0-a02e-161f807af560";
$ch = curl_init("$lmsUrl/api/v1/assessment-items/{$assessmentItemId}");
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'DELETE',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['X-API-Key: ' . getenv('LMS_KEY')],
]);
$response = curl_exec($ch);
if (curl_getinfo($ch, CURLINFO_RESPONSE_CODE) >= 300) {
throw new RuntimeException($response);
}package main
import (
"fmt"
"io"
"net/http"
"os"
)
func main() {
assessmentItemId := "37386ae0-0ea5-44e0-a02e-161f807af560"
req, _ := http.NewRequest("DELETE", os.Getenv("LMS_URL") + "/api/v1/assessment-items/" + assessmentItemId, nil)
req.Header.Set("X-API-Key", os.Getenv("LMS_KEY"))
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
data, _ := io.ReadAll(res.Body)
if res.StatusCode >= 300 {
panic(fmt.Sprintf("%d %s", res.StatusCode, data))
}
_ = data
}Use the latest version of the question
AccessAdmin, or an API key with the write scope.
Re-points a quiz item at the question's newest version. This is deliberate: published quizzes never change underneath learners.
Parameters
| Name | In | Type | Notes |
|---|---|---|---|
| idrequired | path | string (uuid) | The id from a previous response. |
Responses
Errors
| Status | When |
|---|---|
| 400 | The item is a pool, not a pinned question. |
| 401 | Missing, invalid or expired credentials. |
| 403 | Your credential is valid but isn't allowed to do this. |
| 404 | It doesn't exist, or it belongs to another tenant (the two look the same on purpose). |
Errors use RFC 9457 problem details.
ASSESSMENT_ITEM_ID=37386ae0-0ea5-44e0-a02e-161f807af560
curl -X POST "$LMS_URL/api/v1/assessment-items/$ASSESSMENT_ITEM_ID/upgrade" \
-H "X-API-Key: $LMS_KEY"const LMS_URL = process.env.LMS_URL
const LMS_KEY = process.env.LMS_KEY
const assessmentItemId = "37386ae0-0ea5-44e0-a02e-161f807af560"
const res = await fetch(`${LMS_URL}/api/v1/assessment-items/${assessmentItemId}/upgrade`, {
method: 'POST',
headers: { "X-API-Key": LMS_KEY },
})
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`)const LMS_URL = process.env.LMS_URL!
const LMS_KEY = process.env.LMS_KEY!
const assessmentItemId = "37386ae0-0ea5-44e0-a02e-161f807af560"
const res = await fetch(`${LMS_URL}/api/v1/assessment-items/${assessmentItemId}/upgrade`, {
method: 'POST',
headers: { "X-API-Key": LMS_KEY },
})
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`)import os
import requests
LMS_URL = os.environ["LMS_URL"]
HEADERS = {"X-API-Key": os.environ["LMS_KEY"]}
assessment_item_id = "37386ae0-0ea5-44e0-a02e-161f807af560"
res = requests.post(f"{LMS_URL}/api/v1/assessment-items/{assessment_item_id}/upgrade", headers=HEADERS, timeout=10)
res.raise_for_status()import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Request {
public static void main(String[] args) throws Exception {
String lmsUrl = System.getenv("LMS_URL");
String lmsKey = System.getenv("LMS_KEY");
String assessmentItemId = "37386ae0-0ea5-44e0-a02e-161f807af560";
var request = HttpRequest.newBuilder(URI.create(lmsUrl + "/api/v1/assessment-items/" + assessmentItemId + "/upgrade"))
.header("X-API-Key", lmsKey)
.method("POST", HttpRequest.BodyPublishers.noBody())
.build();
var response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
if (response.statusCode() >= 300) throw new IllegalStateException(response.statusCode() + " " + response.body());
}
}require "net/http"
require "json"
lms_url = ENV.fetch("LMS_URL")
assessment_item_id = "37386ae0-0ea5-44e0-a02e-161f807af560"
uri = URI("#{lms_url}/api/v1/assessment-items/#{assessment_item_id}/upgrade")
request = Net::HTTP::Post.new(uri, "X-API-Key" => ENV.fetch("LMS_KEY"))
response = Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == "https") { |http| http.request(request) }
raise "#{response.code} #{response.body}" unless response.is_a?(Net::HTTPSuccess)<?php
$lmsUrl = getenv('LMS_URL');
$assessmentItemId = "37386ae0-0ea5-44e0-a02e-161f807af560";
$ch = curl_init("$lmsUrl/api/v1/assessment-items/{$assessmentItemId}/upgrade");
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['X-API-Key: ' . getenv('LMS_KEY')],
]);
$response = curl_exec($ch);
if (curl_getinfo($ch, CURLINFO_RESPONSE_CODE) >= 300) {
throw new RuntimeException($response);
}package main
import (
"fmt"
"io"
"net/http"
"os"
)
func main() {
assessmentItemId := "37386ae0-0ea5-44e0-a02e-161f807af560"
req, _ := http.NewRequest("POST", os.Getenv("LMS_URL") + "/api/v1/assessment-items/" + assessmentItemId + "/upgrade", nil)
req.Header.Set("X-API-Key", os.Getenv("LMS_KEY"))
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
data, _ := io.ReadAll(res.Body)
if res.StatusCode >= 300 {
panic(fmt.Sprintf("%d %s", res.StatusCode, data))
}
_ = data
}Get a quiz
AccessAdmin, or an API key with the read or write scope.
Returns the quiz's settings and its ordered items. Each item says whether it is a QUESTION (pinned to a specific version) or a POOL, its effective points, and upgradeAvailable when the question has a newer version than the one pinned. totalPoints sums everything (a pool counts poolDrawCount × points).
Parameters
| Name | In | Type | Notes |
|---|---|---|---|
| idrequired | path | string (uuid) | The id from a previous response. |
Responses
Example response
{
"courseVersionId": "81858c49-de53-4f79-a33c-f6900c5a0b75",
"feedbackMode": "AFTER_ATTEMPT",
"id": "37386ae0-0ea5-44e0-a02e-161f807af560",
"instructions": "string",
"items": [
{
"id": "37386ae0-0ea5-44e0-a02e-161f807af560",
"kind": "BUSINESS",
"latestVersionNumber": 1,
"points": 1,
"poolBankId": "2d96d03c-9296-457c-ae5b-8193fa93cc0c",
"poolBankName": "string",
"poolDrawCount": 1,
"position": 0,
"prompt": "Where do you go when the fire alarm sounds?",
"questionId": "53cf0780-692f-4f80-ae4a-4c3fa7aa8180",
"questionVersionId": "feab681a-824d-43fa-a46a-64050ba5aed2",
"type": "SINGLE_CHOICE",
"upgradeAvailable": true,
"versionNumber": 1
}
],
"maxAttempts": 3,
"passPercent": 70,
"shuffleOptions": true,
"shuffleQuestions": true,
"status": "ACTIVE",
"timeLimitSeconds": 1,
"title": "Workplace Safety Essentials",
"totalPoints": 1.5
}Errors
| Status | When |
|---|---|
| 401 | Missing, invalid or expired credentials. |
| 403 | Your credential is valid but isn't allowed to do this. |
| 404 | It doesn't exist, or it belongs to another tenant (the two look the same on purpose). |
Errors use RFC 9457 problem details.
ASSESSMENT_ID=37386ae0-0ea5-44e0-a02e-161f807af560
curl -X GET "$LMS_URL/api/v1/assessments/$ASSESSMENT_ID" \
-H "X-API-Key: $LMS_KEY"const LMS_URL = process.env.LMS_URL
const LMS_KEY = process.env.LMS_KEY
const assessmentId = "37386ae0-0ea5-44e0-a02e-161f807af560"
const res = await fetch(`${LMS_URL}/api/v1/assessments/${assessmentId}`, {
method: 'GET',
headers: { "X-API-Key": LMS_KEY },
})
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`)
const data = await res.json()const LMS_URL = process.env.LMS_URL!
const LMS_KEY = process.env.LMS_KEY!
const assessmentId = "37386ae0-0ea5-44e0-a02e-161f807af560"
const res = await fetch(`${LMS_URL}/api/v1/assessments/${assessmentId}`, {
method: 'GET',
headers: { "X-API-Key": LMS_KEY },
})
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`)
const data: unknown = await res.json()import os
import requests
LMS_URL = os.environ["LMS_URL"]
HEADERS = {"X-API-Key": os.environ["LMS_KEY"]}
assessment_id = "37386ae0-0ea5-44e0-a02e-161f807af560"
res = requests.get(f"{LMS_URL}/api/v1/assessments/{assessment_id}", headers=HEADERS, timeout=10)
res.raise_for_status()
data = res.json()import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Request {
public static void main(String[] args) throws Exception {
String lmsUrl = System.getenv("LMS_URL");
String lmsKey = System.getenv("LMS_KEY");
String assessmentId = "37386ae0-0ea5-44e0-a02e-161f807af560";
var request = HttpRequest.newBuilder(URI.create(lmsUrl + "/api/v1/assessments/" + assessmentId))
.header("X-API-Key", lmsKey)
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
var response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
if (response.statusCode() >= 300) throw new IllegalStateException(response.statusCode() + " " + response.body());
System.out.println(response.body());
}
}require "net/http"
require "json"
lms_url = ENV.fetch("LMS_URL")
assessment_id = "37386ae0-0ea5-44e0-a02e-161f807af560"
uri = URI("#{lms_url}/api/v1/assessments/#{assessment_id}")
request = Net::HTTP::Get.new(uri, "X-API-Key" => ENV.fetch("LMS_KEY"))
response = Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == "https") { |http| http.request(request) }
raise "#{response.code} #{response.body}" unless response.is_a?(Net::HTTPSuccess)
data = JSON.parse(response.body)<?php
$lmsUrl = getenv('LMS_URL');
$assessmentId = "37386ae0-0ea5-44e0-a02e-161f807af560";
$ch = curl_init("$lmsUrl/api/v1/assessments/{$assessmentId}");
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['X-API-Key: ' . getenv('LMS_KEY')],
]);
$response = curl_exec($ch);
if (curl_getinfo($ch, CURLINFO_RESPONSE_CODE) >= 300) {
throw new RuntimeException($response);
}
$data = json_decode($response, true);package main
import (
"fmt"
"io"
"net/http"
"os"
)
func main() {
assessmentId := "37386ae0-0ea5-44e0-a02e-161f807af560"
req, _ := http.NewRequest("GET", os.Getenv("LMS_URL") + "/api/v1/assessments/" + assessmentId, nil)
req.Header.Set("X-API-Key", os.Getenv("LMS_KEY"))
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
data, _ := io.ReadAll(res.Body)
if res.StatusCode >= 300 {
panic(fmt.Sprintf("%d %s", res.StatusCode, data))
}
fmt.Println(string(data))
}Update a quiz's settings
AccessAdmin, or an API key with the write scope.
Replaces the quiz's settings. Only quizzes in a draft can be changed.
Parameters
| Name | In | Type | Notes |
|---|---|---|---|
| idrequired | path | string (uuid) | The id from a previous response. |
Request body application/json · AssessmentInput
| Field | Type | Notes |
|---|---|---|
| feedbackMode | string | matches NEVER|AFTER_ATTEMPT|AFTER_PASS |
| instructions | string | — |
| maxAttempts | integer (int32) | min 1 |
| passPercent | number | 0 to 100 |
| shuffleOptions | boolean | — |
| shuffleQuestions | boolean | — |
| timeLimitSeconds | integer (int32) | min 1 |
| titlerequired | string | min length 1 |
Example request body
{
"title": "Safety knowledge check",
"passPercent": 80,
"maxAttempts": 2,
"feedbackMode": "AFTER_PASS"
}Responses
Errors
| Status | When |
|---|---|
| 400 | The request was malformed or failed validation. errors lists each field. |
| 401 | Missing, invalid or expired credentials. |
| 403 | Your credential is valid but isn't allowed to do this. |
| 404 | It doesn't exist, or it belongs to another tenant (the two look the same on purpose). |
Errors use RFC 9457 problem details.
ASSESSMENT_ID=37386ae0-0ea5-44e0-a02e-161f807af560
curl -X PUT "$LMS_URL/api/v1/assessments/$ASSESSMENT_ID" \
-H "X-API-Key: $LMS_KEY" \
-H "Content-Type: application/json" \
-d '{
"title": "Safety knowledge check",
"passPercent": 80,
"maxAttempts": 2,
"feedbackMode": "AFTER_PASS"
}'const LMS_URL = process.env.LMS_URL
const LMS_KEY = process.env.LMS_KEY
const assessmentId = "37386ae0-0ea5-44e0-a02e-161f807af560"
const res = await fetch(`${LMS_URL}/api/v1/assessments/${assessmentId}`, {
method: 'PUT',
headers: { "X-API-Key": LMS_KEY, 'Content-Type': 'application/json' },
body: JSON.stringify({
"title": "Safety knowledge check",
"passPercent": 80,
"maxAttempts": 2,
"feedbackMode": "AFTER_PASS"
}),
})
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`)const LMS_URL = process.env.LMS_URL!
const LMS_KEY = process.env.LMS_KEY!
const assessmentId = "37386ae0-0ea5-44e0-a02e-161f807af560"
const res = await fetch(`${LMS_URL}/api/v1/assessments/${assessmentId}`, {
method: 'PUT',
headers: { "X-API-Key": LMS_KEY, 'Content-Type': 'application/json' },
body: JSON.stringify({
"title": "Safety knowledge check",
"passPercent": 80,
"maxAttempts": 2,
"feedbackMode": "AFTER_PASS"
}),
})
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`)import os
import requests
LMS_URL = os.environ["LMS_URL"]
HEADERS = {"X-API-Key": os.environ["LMS_KEY"]}
assessment_id = "37386ae0-0ea5-44e0-a02e-161f807af560"
res = requests.put(f"{LMS_URL}/api/v1/assessments/{assessment_id}", headers=HEADERS, json={
"title": "Safety knowledge check",
"passPercent": 80,
"maxAttempts": 2,
"feedbackMode": "AFTER_PASS",
}, timeout=10)
res.raise_for_status()import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Request {
public static void main(String[] args) throws Exception {
String lmsUrl = System.getenv("LMS_URL");
String lmsKey = System.getenv("LMS_KEY");
String assessmentId = "37386ae0-0ea5-44e0-a02e-161f807af560";
String body = """
{
"title": "Safety knowledge check",
"passPercent": 80,
"maxAttempts": 2,
"feedbackMode": "AFTER_PASS"
}
""";
var request = HttpRequest.newBuilder(URI.create(lmsUrl + "/api/v1/assessments/" + assessmentId))
.header("X-API-Key", lmsKey)
.header("Content-Type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString(body))
.build();
var response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
if (response.statusCode() >= 300) throw new IllegalStateException(response.statusCode() + " " + response.body());
}
}require "net/http"
require "json"
lms_url = ENV.fetch("LMS_URL")
assessment_id = "37386ae0-0ea5-44e0-a02e-161f807af560"
uri = URI("#{lms_url}/api/v1/assessments/#{assessment_id}")
request = Net::HTTP::Put.new(uri, "X-API-Key" => ENV.fetch("LMS_KEY"), "Content-Type" => "application/json")
request.body = {
"title" => "Safety knowledge check",
"passPercent" => 80,
"maxAttempts" => 2,
"feedbackMode" => "AFTER_PASS",
}.to_json
response = Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == "https") { |http| http.request(request) }
raise "#{response.code} #{response.body}" unless response.is_a?(Net::HTTPSuccess)<?php
$lmsUrl = getenv('LMS_URL');
$assessmentId = "37386ae0-0ea5-44e0-a02e-161f807af560";
$ch = curl_init("$lmsUrl/api/v1/assessments/{$assessmentId}");
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'PUT',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['X-API-Key: ' . getenv('LMS_KEY'), 'Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode([
"title" => "Safety knowledge check",
"passPercent" => 80,
"maxAttempts" => 2,
"feedbackMode" => "AFTER_PASS",
]),
]);
$response = curl_exec($ch);
if (curl_getinfo($ch, CURLINFO_RESPONSE_CODE) >= 300) {
throw new RuntimeException($response);
}package main
import (
"fmt"
"io"
"net/http"
"os"
"strings"
)
func main() {
assessmentId := "37386ae0-0ea5-44e0-a02e-161f807af560"
body := strings.NewReader(`{
"title": "Safety knowledge check",
"passPercent": 80,
"maxAttempts": 2,
"feedbackMode": "AFTER_PASS"
}`)
req, _ := http.NewRequest("PUT", os.Getenv("LMS_URL") + "/api/v1/assessments/" + assessmentId, body)
req.Header.Set("X-API-Key", os.Getenv("LMS_KEY"))
req.Header.Set("Content-Type", "application/json")
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
data, _ := io.ReadAll(res.Body)
if res.StatusCode >= 300 {
panic(fmt.Sprintf("%d %s", res.StatusCode, data))
}
_ = data
}Delete a quiz
AccessAdmin, or an API key with the write scope.
Deletes the quiz and its items. Its questions stay in your banks.
Parameters
| Name | In | Type | Notes |
|---|---|---|---|
| idrequired | path | string (uuid) | The id from a previous response. |
Responses
Errors
| Status | When |
|---|---|
| 401 | Missing, invalid or expired credentials. |
| 403 | Your credential is valid but isn't allowed to do this. |
| 404 | It doesn't exist, or it belongs to another tenant (the two look the same on purpose). |
| 409 | A lesson block still uses this quiz. Remove the block first. |
Errors use RFC 9457 problem details.
ASSESSMENT_ID=37386ae0-0ea5-44e0-a02e-161f807af560
curl -X DELETE "$LMS_URL/api/v1/assessments/$ASSESSMENT_ID" \
-H "X-API-Key: $LMS_KEY"const LMS_URL = process.env.LMS_URL
const LMS_KEY = process.env.LMS_KEY
const assessmentId = "37386ae0-0ea5-44e0-a02e-161f807af560"
const res = await fetch(`${LMS_URL}/api/v1/assessments/${assessmentId}`, {
method: 'DELETE',
headers: { "X-API-Key": LMS_KEY },
})
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`)const LMS_URL = process.env.LMS_URL!
const LMS_KEY = process.env.LMS_KEY!
const assessmentId = "37386ae0-0ea5-44e0-a02e-161f807af560"
const res = await fetch(`${LMS_URL}/api/v1/assessments/${assessmentId}`, {
method: 'DELETE',
headers: { "X-API-Key": LMS_KEY },
})
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`)import os
import requests
LMS_URL = os.environ["LMS_URL"]
HEADERS = {"X-API-Key": os.environ["LMS_KEY"]}
assessment_id = "37386ae0-0ea5-44e0-a02e-161f807af560"
res = requests.delete(f"{LMS_URL}/api/v1/assessments/{assessment_id}", headers=HEADERS, timeout=10)
res.raise_for_status()import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Request {
public static void main(String[] args) throws Exception {
String lmsUrl = System.getenv("LMS_URL");
String lmsKey = System.getenv("LMS_KEY");
String assessmentId = "37386ae0-0ea5-44e0-a02e-161f807af560";
var request = HttpRequest.newBuilder(URI.create(lmsUrl + "/api/v1/assessments/" + assessmentId))
.header("X-API-Key", lmsKey)
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
var response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
if (response.statusCode() >= 300) throw new IllegalStateException(response.statusCode() + " " + response.body());
}
}require "net/http"
require "json"
lms_url = ENV.fetch("LMS_URL")
assessment_id = "37386ae0-0ea5-44e0-a02e-161f807af560"
uri = URI("#{lms_url}/api/v1/assessments/#{assessment_id}")
request = Net::HTTP::Delete.new(uri, "X-API-Key" => ENV.fetch("LMS_KEY"))
response = Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == "https") { |http| http.request(request) }
raise "#{response.code} #{response.body}" unless response.is_a?(Net::HTTPSuccess)<?php
$lmsUrl = getenv('LMS_URL');
$assessmentId = "37386ae0-0ea5-44e0-a02e-161f807af560";
$ch = curl_init("$lmsUrl/api/v1/assessments/{$assessmentId}");
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'DELETE',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['X-API-Key: ' . getenv('LMS_KEY')],
]);
$response = curl_exec($ch);
if (curl_getinfo($ch, CURLINFO_RESPONSE_CODE) >= 300) {
throw new RuntimeException($response);
}package main
import (
"fmt"
"io"
"net/http"
"os"
)
func main() {
assessmentId := "37386ae0-0ea5-44e0-a02e-161f807af560"
req, _ := http.NewRequest("DELETE", os.Getenv("LMS_URL") + "/api/v1/assessments/" + assessmentId, nil)
req.Header.Set("X-API-Key", os.Getenv("LMS_KEY"))
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
data, _ := io.ReadAll(res.Body)
if res.StatusCode >= 300 {
panic(fmt.Sprintf("%d %s", res.StatusCode, data))
}
_ = data
}Add a question or pool to a quiz
AccessAdmin, or an API key with the write scope.
Send exactly one of:
questionId: pins the question's latest versionquestionVersionId: pins a specific versionpoolBankId: draws random questions from a bank at attempt time. A pool also needspoolDrawCountandpointsOverride(points per drawn question).
pointsOverride on a single question overrides its own points for this quiz only.
Parameters
| Name | In | Type | Notes |
|---|---|---|---|
| idrequired | path | string (uuid) | The id from a previous response. |
Request body application/json · ItemCreate
| Field | Type | Notes |
|---|---|---|
| pointsOverride | number | min 0 |
| poolBankId | string (uuid) | — |
| poolDrawCount | integer (int32) | min 1 |
| position | integer (int32) | min 0 |
| questionId | string (uuid) | — |
| questionVersionId | string (uuid) | — |
Example request body
{
"questionId": "2d94b1a6-7c30-4e5f-8a19-3b6c0f72d845",
"pointsOverride": 2
}Responses
Example response
{
"id": "37386ae0-0ea5-44e0-a02e-161f807af560"
}Errors
| Status | When |
|---|---|
| 400 | Not exactly one of the three, a pool missing its count or points, or an unknown or archived question. |
| 401 | Missing, invalid or expired credentials. |
| 403 | Your credential is valid but isn't allowed to do this. |
| 404 | It doesn't exist, or it belongs to another tenant (the two look the same on purpose). |
Errors use RFC 9457 problem details.
ASSESSMENT_ID=37386ae0-0ea5-44e0-a02e-161f807af560
curl -X POST "$LMS_URL/api/v1/assessments/$ASSESSMENT_ID/items" \
-H "X-API-Key: $LMS_KEY" \
-H "Content-Type: application/json" \
-d '{
"questionId": "2d94b1a6-7c30-4e5f-8a19-3b6c0f72d845",
"pointsOverride": 2
}'const LMS_URL = process.env.LMS_URL
const LMS_KEY = process.env.LMS_KEY
const assessmentId = "37386ae0-0ea5-44e0-a02e-161f807af560"
const res = await fetch(`${LMS_URL}/api/v1/assessments/${assessmentId}/items`, {
method: 'POST',
headers: { "X-API-Key": LMS_KEY, 'Content-Type': 'application/json' },
body: JSON.stringify({
"questionId": "2d94b1a6-7c30-4e5f-8a19-3b6c0f72d845",
"pointsOverride": 2
}),
})
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`)
const data = await res.json()const LMS_URL = process.env.LMS_URL!
const LMS_KEY = process.env.LMS_KEY!
const assessmentId = "37386ae0-0ea5-44e0-a02e-161f807af560"
const res = await fetch(`${LMS_URL}/api/v1/assessments/${assessmentId}/items`, {
method: 'POST',
headers: { "X-API-Key": LMS_KEY, 'Content-Type': 'application/json' },
body: JSON.stringify({
"questionId": "2d94b1a6-7c30-4e5f-8a19-3b6c0f72d845",
"pointsOverride": 2
}),
})
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`)
const data: unknown = await res.json()import os
import requests
LMS_URL = os.environ["LMS_URL"]
HEADERS = {"X-API-Key": os.environ["LMS_KEY"]}
assessment_id = "37386ae0-0ea5-44e0-a02e-161f807af560"
res = requests.post(f"{LMS_URL}/api/v1/assessments/{assessment_id}/items", headers=HEADERS, json={
"questionId": "2d94b1a6-7c30-4e5f-8a19-3b6c0f72d845",
"pointsOverride": 2,
}, timeout=10)
res.raise_for_status()
data = res.json()import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Request {
public static void main(String[] args) throws Exception {
String lmsUrl = System.getenv("LMS_URL");
String lmsKey = System.getenv("LMS_KEY");
String assessmentId = "37386ae0-0ea5-44e0-a02e-161f807af560";
String body = """
{
"questionId": "2d94b1a6-7c30-4e5f-8a19-3b6c0f72d845",
"pointsOverride": 2
}
""";
var request = HttpRequest.newBuilder(URI.create(lmsUrl + "/api/v1/assessments/" + assessmentId + "/items"))
.header("X-API-Key", lmsKey)
.header("Content-Type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString(body))
.build();
var response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
if (response.statusCode() >= 300) throw new IllegalStateException(response.statusCode() + " " + response.body());
System.out.println(response.body());
}
}require "net/http"
require "json"
lms_url = ENV.fetch("LMS_URL")
assessment_id = "37386ae0-0ea5-44e0-a02e-161f807af560"
uri = URI("#{lms_url}/api/v1/assessments/#{assessment_id}/items")
request = Net::HTTP::Post.new(uri, "X-API-Key" => ENV.fetch("LMS_KEY"), "Content-Type" => "application/json")
request.body = {
"questionId" => "2d94b1a6-7c30-4e5f-8a19-3b6c0f72d845",
"pointsOverride" => 2,
}.to_json
response = Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == "https") { |http| http.request(request) }
raise "#{response.code} #{response.body}" unless response.is_a?(Net::HTTPSuccess)
data = JSON.parse(response.body)<?php
$lmsUrl = getenv('LMS_URL');
$assessmentId = "37386ae0-0ea5-44e0-a02e-161f807af560";
$ch = curl_init("$lmsUrl/api/v1/assessments/{$assessmentId}/items");
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['X-API-Key: ' . getenv('LMS_KEY'), 'Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode([
"questionId" => "2d94b1a6-7c30-4e5f-8a19-3b6c0f72d845",
"pointsOverride" => 2,
]),
]);
$response = curl_exec($ch);
if (curl_getinfo($ch, CURLINFO_RESPONSE_CODE) >= 300) {
throw new RuntimeException($response);
}
$data = json_decode($response, true);package main
import (
"fmt"
"io"
"net/http"
"os"
"strings"
)
func main() {
assessmentId := "37386ae0-0ea5-44e0-a02e-161f807af560"
body := strings.NewReader(`{
"questionId": "2d94b1a6-7c30-4e5f-8a19-3b6c0f72d845",
"pointsOverride": 2
}`)
req, _ := http.NewRequest("POST", os.Getenv("LMS_URL") + "/api/v1/assessments/" + assessmentId + "/items", body)
req.Header.Set("X-API-Key", os.Getenv("LMS_KEY"))
req.Header.Set("Content-Type", "application/json")
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
data, _ := io.ReadAll(res.Body)
if res.StatusCode >= 300 {
panic(fmt.Sprintf("%d %s", res.StatusCode, data))
}
fmt.Println(string(data))
}Reorder a quiz's items
AccessAdmin, or an API key with the write scope.
Sets the order. ids must list every item exactly once.
Parameters
| Name | In | Type | Notes |
|---|---|---|---|
| idrequired | path | string (uuid) | The id from a previous response. |
Request body application/json · Order
| Field | Type | Notes |
|---|---|---|
| idsrequired | string (uuid)[] | min 1 item |
Example request body
{
"ids": [
"37386ae0-0ea5-44e0-a02e-161f807af560"
]
}Responses
Errors
| Status | When |
|---|---|
| 400 | The request was malformed or failed validation. errors lists each field. |
| 401 | Missing, invalid or expired credentials. |
| 403 | Your credential is valid but isn't allowed to do this. |
| 404 | It doesn't exist, or it belongs to another tenant (the two look the same on purpose). |
Errors use RFC 9457 problem details.
ASSESSMENT_ID=37386ae0-0ea5-44e0-a02e-161f807af560
curl -X POST "$LMS_URL/api/v1/assessments/$ASSESSMENT_ID/items/order" \
-H "X-API-Key: $LMS_KEY" \
-H "Content-Type: application/json" \
-d '{
"ids": [
"37386ae0-0ea5-44e0-a02e-161f807af560"
]
}'const LMS_URL = process.env.LMS_URL
const LMS_KEY = process.env.LMS_KEY
const assessmentId = "37386ae0-0ea5-44e0-a02e-161f807af560"
const res = await fetch(`${LMS_URL}/api/v1/assessments/${assessmentId}/items/order`, {
method: 'POST',
headers: { "X-API-Key": LMS_KEY, 'Content-Type': 'application/json' },
body: JSON.stringify({
"ids": [
"37386ae0-0ea5-44e0-a02e-161f807af560"
]
}),
})
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`)const LMS_URL = process.env.LMS_URL!
const LMS_KEY = process.env.LMS_KEY!
const assessmentId = "37386ae0-0ea5-44e0-a02e-161f807af560"
const res = await fetch(`${LMS_URL}/api/v1/assessments/${assessmentId}/items/order`, {
method: 'POST',
headers: { "X-API-Key": LMS_KEY, 'Content-Type': 'application/json' },
body: JSON.stringify({
"ids": [
"37386ae0-0ea5-44e0-a02e-161f807af560"
]
}),
})
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`)import os
import requests
LMS_URL = os.environ["LMS_URL"]
HEADERS = {"X-API-Key": os.environ["LMS_KEY"]}
assessment_id = "37386ae0-0ea5-44e0-a02e-161f807af560"
res = requests.post(f"{LMS_URL}/api/v1/assessments/{assessment_id}/items/order", headers=HEADERS, json={
"ids": [
"37386ae0-0ea5-44e0-a02e-161f807af560",
],
}, timeout=10)
res.raise_for_status()import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Request {
public static void main(String[] args) throws Exception {
String lmsUrl = System.getenv("LMS_URL");
String lmsKey = System.getenv("LMS_KEY");
String assessmentId = "37386ae0-0ea5-44e0-a02e-161f807af560";
String body = """
{
"ids": [
"37386ae0-0ea5-44e0-a02e-161f807af560"
]
}
""";
var request = HttpRequest.newBuilder(URI.create(lmsUrl + "/api/v1/assessments/" + assessmentId + "/items/order"))
.header("X-API-Key", lmsKey)
.header("Content-Type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString(body))
.build();
var response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
if (response.statusCode() >= 300) throw new IllegalStateException(response.statusCode() + " " + response.body());
}
}require "net/http"
require "json"
lms_url = ENV.fetch("LMS_URL")
assessment_id = "37386ae0-0ea5-44e0-a02e-161f807af560"
uri = URI("#{lms_url}/api/v1/assessments/#{assessment_id}/items/order")
request = Net::HTTP::Post.new(uri, "X-API-Key" => ENV.fetch("LMS_KEY"), "Content-Type" => "application/json")
request.body = {
"ids" => [
"37386ae0-0ea5-44e0-a02e-161f807af560",
],
}.to_json
response = Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == "https") { |http| http.request(request) }
raise "#{response.code} #{response.body}" unless response.is_a?(Net::HTTPSuccess)<?php
$lmsUrl = getenv('LMS_URL');
$assessmentId = "37386ae0-0ea5-44e0-a02e-161f807af560";
$ch = curl_init("$lmsUrl/api/v1/assessments/{$assessmentId}/items/order");
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['X-API-Key: ' . getenv('LMS_KEY'), 'Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode([
"ids" => [
"37386ae0-0ea5-44e0-a02e-161f807af560",
],
]),
]);
$response = curl_exec($ch);
if (curl_getinfo($ch, CURLINFO_RESPONSE_CODE) >= 300) {
throw new RuntimeException($response);
}package main
import (
"fmt"
"io"
"net/http"
"os"
"strings"
)
func main() {
assessmentId := "37386ae0-0ea5-44e0-a02e-161f807af560"
body := strings.NewReader(`{
"ids": [
"37386ae0-0ea5-44e0-a02e-161f807af560"
]
}`)
req, _ := http.NewRequest("POST", os.Getenv("LMS_URL") + "/api/v1/assessments/" + assessmentId + "/items/order", body)
req.Header.Set("X-API-Key", os.Getenv("LMS_KEY"))
req.Header.Set("Content-Type", "application/json")
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
data, _ := io.ReadAll(res.Body)
if res.StatusCode >= 300 {
panic(fmt.Sprintf("%d %s", res.StatusCode, data))
}
_ = data
}Create a quiz
AccessAdmin, or an API key with the write scope.
Creates an assessment in the course's draft. It does nothing until you add questions (POST /assessments/{id}/items) and place it in a lesson with an ASSESSMENT block.
Settings: passPercent (default 70), maxAttempts (omit for unlimited), timeLimitSeconds (omit for untimed), shuffling, and feedbackMode (NEVER, AFTER_ATTEMPT or AFTER_PASS).
Parameters
| Name | In | Type | Notes |
|---|---|---|---|
| courseIdrequired | path | string (uuid) | The id from a previous response. |
Request body application/json · AssessmentInput
| Field | Type | Notes |
|---|---|---|
| feedbackMode | string | matches NEVER|AFTER_ATTEMPT|AFTER_PASS |
| instructions | string | — |
| maxAttempts | integer (int32) | min 1 |
| passPercent | number | 0 to 100 |
| shuffleOptions | boolean | — |
| shuffleQuestions | boolean | — |
| timeLimitSeconds | integer (int32) | min 1 |
| titlerequired | string | min length 1 |
Example request body
{
"title": "Safety knowledge check",
"instructions": "Answer every question. You need 70% to pass.",
"passPercent": 70,
"maxAttempts": 3,
"timeLimitSeconds": 900,
"shuffleQuestions": true,
"feedbackMode": "AFTER_ATTEMPT"
}Responses
Example response
{
"id": "37386ae0-0ea5-44e0-a02e-161f807af560"
}Errors
| Status | When |
|---|---|
| 400 | The request was malformed or failed validation. errors lists each field. |
| 401 | Missing, invalid or expired credentials. |
| 403 | Your credential is valid but isn't allowed to do this. |
| 404 | It doesn't exist, or it belongs to another tenant (the two look the same on purpose). |
| 409 | The course has no draft. |
Errors use RFC 9457 problem details.
COURSE_ID=ecec91e5-4eb9-4c55-a6a7-b3c44ebe7561
curl -X POST "$LMS_URL/api/v1/courses/$COURSE_ID/draft/assessments" \
-H "X-API-Key: $LMS_KEY" \
-H "Content-Type: application/json" \
-d '{
"title": "Safety knowledge check",
"instructions": "Answer every question. You need 70% to pass.",
"passPercent": 70,
"maxAttempts": 3,
"timeLimitSeconds": 900,
"shuffleQuestions": true,
"feedbackMode": "AFTER_ATTEMPT"
}'const LMS_URL = process.env.LMS_URL
const LMS_KEY = process.env.LMS_KEY
const courseId = "ecec91e5-4eb9-4c55-a6a7-b3c44ebe7561"
const res = await fetch(`${LMS_URL}/api/v1/courses/${courseId}/draft/assessments`, {
method: 'POST',
headers: { "X-API-Key": LMS_KEY, 'Content-Type': 'application/json' },
body: JSON.stringify({
"title": "Safety knowledge check",
"instructions": "Answer every question. You need 70% to pass.",
"passPercent": 70,
"maxAttempts": 3,
"timeLimitSeconds": 900,
"shuffleQuestions": true,
"feedbackMode": "AFTER_ATTEMPT"
}),
})
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`)
const data = await res.json()const LMS_URL = process.env.LMS_URL!
const LMS_KEY = process.env.LMS_KEY!
const courseId = "ecec91e5-4eb9-4c55-a6a7-b3c44ebe7561"
const res = await fetch(`${LMS_URL}/api/v1/courses/${courseId}/draft/assessments`, {
method: 'POST',
headers: { "X-API-Key": LMS_KEY, 'Content-Type': 'application/json' },
body: JSON.stringify({
"title": "Safety knowledge check",
"instructions": "Answer every question. You need 70% to pass.",
"passPercent": 70,
"maxAttempts": 3,
"timeLimitSeconds": 900,
"shuffleQuestions": true,
"feedbackMode": "AFTER_ATTEMPT"
}),
})
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`)
const data: unknown = await res.json()import os
import requests
LMS_URL = os.environ["LMS_URL"]
HEADERS = {"X-API-Key": os.environ["LMS_KEY"]}
course_id = "ecec91e5-4eb9-4c55-a6a7-b3c44ebe7561"
res = requests.post(f"{LMS_URL}/api/v1/courses/{course_id}/draft/assessments", headers=HEADERS, json={
"title": "Safety knowledge check",
"instructions": "Answer every question. You need 70% to pass.",
"passPercent": 70,
"maxAttempts": 3,
"timeLimitSeconds": 900,
"shuffleQuestions": True,
"feedbackMode": "AFTER_ATTEMPT",
}, timeout=10)
res.raise_for_status()
data = res.json()import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Request {
public static void main(String[] args) throws Exception {
String lmsUrl = System.getenv("LMS_URL");
String lmsKey = System.getenv("LMS_KEY");
String courseId = "ecec91e5-4eb9-4c55-a6a7-b3c44ebe7561";
String body = """
{
"title": "Safety knowledge check",
"instructions": "Answer every question. You need 70% to pass.",
"passPercent": 70,
"maxAttempts": 3,
"timeLimitSeconds": 900,
"shuffleQuestions": true,
"feedbackMode": "AFTER_ATTEMPT"
}
""";
var request = HttpRequest.newBuilder(URI.create(lmsUrl + "/api/v1/courses/" + courseId + "/draft/assessments"))
.header("X-API-Key", lmsKey)
.header("Content-Type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString(body))
.build();
var response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
if (response.statusCode() >= 300) throw new IllegalStateException(response.statusCode() + " " + response.body());
System.out.println(response.body());
}
}require "net/http"
require "json"
lms_url = ENV.fetch("LMS_URL")
course_id = "ecec91e5-4eb9-4c55-a6a7-b3c44ebe7561"
uri = URI("#{lms_url}/api/v1/courses/#{course_id}/draft/assessments")
request = Net::HTTP::Post.new(uri, "X-API-Key" => ENV.fetch("LMS_KEY"), "Content-Type" => "application/json")
request.body = {
"title" => "Safety knowledge check",
"instructions" => "Answer every question. You need 70% to pass.",
"passPercent" => 70,
"maxAttempts" => 3,
"timeLimitSeconds" => 900,
"shuffleQuestions" => true,
"feedbackMode" => "AFTER_ATTEMPT",
}.to_json
response = Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == "https") { |http| http.request(request) }
raise "#{response.code} #{response.body}" unless response.is_a?(Net::HTTPSuccess)
data = JSON.parse(response.body)<?php
$lmsUrl = getenv('LMS_URL');
$courseId = "ecec91e5-4eb9-4c55-a6a7-b3c44ebe7561";
$ch = curl_init("$lmsUrl/api/v1/courses/{$courseId}/draft/assessments");
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['X-API-Key: ' . getenv('LMS_KEY'), 'Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode([
"title" => "Safety knowledge check",
"instructions" => "Answer every question. You need 70% to pass.",
"passPercent" => 70,
"maxAttempts" => 3,
"timeLimitSeconds" => 900,
"shuffleQuestions" => true,
"feedbackMode" => "AFTER_ATTEMPT",
]),
]);
$response = curl_exec($ch);
if (curl_getinfo($ch, CURLINFO_RESPONSE_CODE) >= 300) {
throw new RuntimeException($response);
}
$data = json_decode($response, true);package main
import (
"fmt"
"io"
"net/http"
"os"
"strings"
)
func main() {
courseId := "ecec91e5-4eb9-4c55-a6a7-b3c44ebe7561"
body := strings.NewReader(`{
"title": "Safety knowledge check",
"instructions": "Answer every question. You need 70% to pass.",
"passPercent": 70,
"maxAttempts": 3,
"timeLimitSeconds": 900,
"shuffleQuestions": true,
"feedbackMode": "AFTER_ATTEMPT"
}`)
req, _ := http.NewRequest("POST", os.Getenv("LMS_URL") + "/api/v1/courses/" + courseId + "/draft/assessments", body)
req.Header.Set("X-API-Key", os.Getenv("LMS_KEY"))
req.Header.Set("Content-Type", "application/json")
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
data, _ := io.ReadAll(res.Body)
if res.StatusCode >= 300 {
panic(fmt.Sprintf("%d %s", res.StatusCode, data))
}
fmt.Println(string(data))
}