Docs API reference
Sections, lessons & blocks
The content tree inside a draft course.
Courses contain sections (modules), sections contain lessons, and lessons contain ordered content blocks. All of these are editable only while they belong to a draft version. See Content blocks.
13 endpoints · base path /api/v1
Update a block
AccessAdmin, or an API key with the write scope.
Replaces a block's content, assetId and assessmentId. The block's type can't change; delete it and add a new one instead. The new content is validated against the block's type.
Parameters
| Name | In | Type | Notes |
|---|---|---|---|
| idrequired | path | string (uuid) | The id from a previous response. |
Request body application/json · BlockUpdate
| Field | Type | Notes |
|---|---|---|
| assessmentId | string (uuid) | — |
| assetId | string (uuid) | — |
| content | JsonNode | — |
Example request body
{
"content": {
"markdown": "## Welcome\n\nUpdated text."
}
}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.
BLOCK_ID=37386ae0-0ea5-44e0-a02e-161f807af560
curl -X PUT "$LMS_URL/api/v1/blocks/$BLOCK_ID" \
-H "X-API-Key: $LMS_KEY" \
-H "Content-Type: application/json" \
-d '{
"content": {
"markdown": "## Welcome\n\nUpdated text."
}
}'const LMS_URL = process.env.LMS_URL
const LMS_KEY = process.env.LMS_KEY
const blockId = "37386ae0-0ea5-44e0-a02e-161f807af560"
const res = await fetch(`${LMS_URL}/api/v1/blocks/${blockId}`, {
method: 'PUT',
headers: { "X-API-Key": LMS_KEY, 'Content-Type': 'application/json' },
body: JSON.stringify({
"content": {
"markdown": "## Welcome\n\nUpdated text."
}
}),
})
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 blockId = "37386ae0-0ea5-44e0-a02e-161f807af560"
const res = await fetch(`${LMS_URL}/api/v1/blocks/${blockId}`, {
method: 'PUT',
headers: { "X-API-Key": LMS_KEY, 'Content-Type': 'application/json' },
body: JSON.stringify({
"content": {
"markdown": "## Welcome\n\nUpdated text."
}
}),
})
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"]}
block_id = "37386ae0-0ea5-44e0-a02e-161f807af560"
res = requests.put(f"{LMS_URL}/api/v1/blocks/{block_id}", headers=HEADERS, json={
"content": {
"markdown": "## Welcome\n\nUpdated text.",
},
}, 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 blockId = "37386ae0-0ea5-44e0-a02e-161f807af560";
String body = """
{
"content": {
"markdown": "## Welcome\\n\\nUpdated text."
}
}
""";
var request = HttpRequest.newBuilder(URI.create(lmsUrl + "/api/v1/blocks/" + blockId))
.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")
block_id = "37386ae0-0ea5-44e0-a02e-161f807af560"
uri = URI("#{lms_url}/api/v1/blocks/#{block_id}")
request = Net::HTTP::Put.new(uri, "X-API-Key" => ENV.fetch("LMS_KEY"), "Content-Type" => "application/json")
request.body = {
"content" => {
"markdown" => "## Welcome\n\nUpdated text.",
},
}.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');
$blockId = "37386ae0-0ea5-44e0-a02e-161f807af560";
$ch = curl_init("$lmsUrl/api/v1/blocks/{$blockId}");
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([
"content" => [
"markdown" => "## Welcome\n\nUpdated text.",
],
]),
]);
$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() {
blockId := "37386ae0-0ea5-44e0-a02e-161f807af560"
body := strings.NewReader(`{
"content": {
"markdown": "## Welcome\n\nUpdated text."
}
}`)
req, _ := http.NewRequest("PUT", os.Getenv("LMS_URL") + "/api/v1/blocks/" + blockId, 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 block
AccessAdmin, or an API key with the write scope.
Deletes the block. Remaining blocks 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.
BLOCK_ID=37386ae0-0ea5-44e0-a02e-161f807af560
curl -X DELETE "$LMS_URL/api/v1/blocks/$BLOCK_ID" \
-H "X-API-Key: $LMS_KEY"const LMS_URL = process.env.LMS_URL
const LMS_KEY = process.env.LMS_KEY
const blockId = "37386ae0-0ea5-44e0-a02e-161f807af560"
const res = await fetch(`${LMS_URL}/api/v1/blocks/${blockId}`, {
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 blockId = "37386ae0-0ea5-44e0-a02e-161f807af560"
const res = await fetch(`${LMS_URL}/api/v1/blocks/${blockId}`, {
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"]}
block_id = "37386ae0-0ea5-44e0-a02e-161f807af560"
res = requests.delete(f"{LMS_URL}/api/v1/blocks/{block_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 blockId = "37386ae0-0ea5-44e0-a02e-161f807af560";
var request = HttpRequest.newBuilder(URI.create(lmsUrl + "/api/v1/blocks/" + blockId))
.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")
block_id = "37386ae0-0ea5-44e0-a02e-161f807af560"
uri = URI("#{lms_url}/api/v1/blocks/#{block_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');
$blockId = "37386ae0-0ea5-44e0-a02e-161f807af560";
$ch = curl_init("$lmsUrl/api/v1/blocks/{$blockId}");
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() {
blockId := "37386ae0-0ea5-44e0-a02e-161f807af560"
req, _ := http.NewRequest("DELETE", os.Getenv("LMS_URL") + "/api/v1/blocks/" + blockId, 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 section
AccessAdmin, or an API key with the write scope.
Adds a section (module) to the draft. position is zero-based; omit it to append. Returns the new id.
Parameters
| Name | In | Type | Notes |
|---|---|---|---|
| idrequired | path | string (uuid) | The id from a previous response. |
Request body application/json · ModuleInput
| Field | Type | Notes |
|---|---|---|
| description | string | — |
| position | integer (int32) | min 0 |
| titlerequired | string | min length 1 |
Example request body
{
"description": "A short description.",
"position": 0,
"title": "Workplace Safety Essentials"
}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. Start one first. |
Errors use RFC 9457 problem details.
COURSE_ID=37386ae0-0ea5-44e0-a02e-161f807af560
curl -X POST "$LMS_URL/api/v1/courses/$COURSE_ID/draft/modules" \
-H "X-API-Key: $LMS_KEY" \
-H "Content-Type: application/json" \
-d '{
"description": "A short description.",
"position": 0,
"title": "Workplace Safety Essentials"
}'const LMS_URL = process.env.LMS_URL
const LMS_KEY = process.env.LMS_KEY
const courseId = "37386ae0-0ea5-44e0-a02e-161f807af560"
const res = await fetch(`${LMS_URL}/api/v1/courses/${courseId}/draft/modules`, {
method: 'POST',
headers: { "X-API-Key": LMS_KEY, 'Content-Type': 'application/json' },
body: JSON.stringify({
"description": "A short description.",
"position": 0,
"title": "Workplace Safety Essentials"
}),
})
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 = "37386ae0-0ea5-44e0-a02e-161f807af560"
const res = await fetch(`${LMS_URL}/api/v1/courses/${courseId}/draft/modules`, {
method: 'POST',
headers: { "X-API-Key": LMS_KEY, 'Content-Type': 'application/json' },
body: JSON.stringify({
"description": "A short description.",
"position": 0,
"title": "Workplace Safety Essentials"
}),
})
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 = "37386ae0-0ea5-44e0-a02e-161f807af560"
res = requests.post(f"{LMS_URL}/api/v1/courses/{course_id}/draft/modules", headers=HEADERS, json={
"description": "A short description.",
"position": 0,
"title": "Workplace Safety Essentials",
}, 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 = "37386ae0-0ea5-44e0-a02e-161f807af560";
String body = """
{
"description": "A short description.",
"position": 0,
"title": "Workplace Safety Essentials"
}
""";
var request = HttpRequest.newBuilder(URI.create(lmsUrl + "/api/v1/courses/" + courseId + "/draft/modules"))
.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 = "37386ae0-0ea5-44e0-a02e-161f807af560"
uri = URI("#{lms_url}/api/v1/courses/#{course_id}/draft/modules")
request = Net::HTTP::Post.new(uri, "X-API-Key" => ENV.fetch("LMS_KEY"), "Content-Type" => "application/json")
request.body = {
"description" => "A short description.",
"position" => 0,
"title" => "Workplace Safety Essentials",
}.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 = "37386ae0-0ea5-44e0-a02e-161f807af560";
$ch = curl_init("$lmsUrl/api/v1/courses/{$courseId}/draft/modules");
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([
"description" => "A short description.",
"position" => 0,
"title" => "Workplace Safety Essentials",
]),
]);
$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 := "37386ae0-0ea5-44e0-a02e-161f807af560"
body := strings.NewReader(`{
"description": "A short description.",
"position": 0,
"title": "Workplace Safety Essentials"
}`)
req, _ := http.NewRequest("POST", os.Getenv("LMS_URL") + "/api/v1/courses/" + courseId + "/draft/modules", 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 sections
AccessAdmin, or an API key with the write scope.
Sets the order of the draft's sections. ids must list every section exactly once, in the new order.
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 | ids is missing a section, repeats one, or includes one that isn't in this draft. |
| 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.
COURSE_ID=37386ae0-0ea5-44e0-a02e-161f807af560
curl -X POST "$LMS_URL/api/v1/courses/$COURSE_ID/draft/modules/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 courseId = "37386ae0-0ea5-44e0-a02e-161f807af560"
const res = await fetch(`${LMS_URL}/api/v1/courses/${courseId}/draft/modules/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 courseId = "37386ae0-0ea5-44e0-a02e-161f807af560"
const res = await fetch(`${LMS_URL}/api/v1/courses/${courseId}/draft/modules/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"]}
course_id = "37386ae0-0ea5-44e0-a02e-161f807af560"
res = requests.post(f"{LMS_URL}/api/v1/courses/{course_id}/draft/modules/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 courseId = "37386ae0-0ea5-44e0-a02e-161f807af560";
String body = """
{
"ids": [
"37386ae0-0ea5-44e0-a02e-161f807af560"
]
}
""";
var request = HttpRequest.newBuilder(URI.create(lmsUrl + "/api/v1/courses/" + courseId + "/draft/modules/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")
course_id = "37386ae0-0ea5-44e0-a02e-161f807af560"
uri = URI("#{lms_url}/api/v1/courses/#{course_id}/draft/modules/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');
$courseId = "37386ae0-0ea5-44e0-a02e-161f807af560";
$ch = curl_init("$lmsUrl/api/v1/courses/{$courseId}/draft/modules/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() {
courseId := "37386ae0-0ea5-44e0-a02e-161f807af560"
body := strings.NewReader(`{
"ids": [
"37386ae0-0ea5-44e0-a02e-161f807af560"
]
}`)
req, _ := http.NewRequest("POST", os.Getenv("LMS_URL") + "/api/v1/courses/" + courseId + "/draft/modules/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
}Update a lesson
AccessAdmin, or an API key with the write scope.
Replaces the lesson's title, required flag, completion mode, unlock mode and estimated time.
Parameters
| Name | In | Type | Notes |
|---|---|---|---|
| idrequired | path | string (uuid) | The id from a previous response. |
Request body application/json · LessonUpdate
| Field | Type | Notes |
|---|---|---|
| completionMode | string | matches MANUAL|VIEWED|ASSESSMENT_PASSED |
| estimatedMinutes | integer (int32) | min 0 |
| isRequired | boolean | — |
| titlerequired | string | min length 1 |
| unlockMode | string | matches OPEN|AFTER_PREVIOUS |
Example request body
{
"completionMode": "MANUAL",
"estimatedMinutes": 30,
"isRequired": true,
"title": "Workplace Safety Essentials",
"unlockMode": "OPEN"
}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.
LESSON_ID=37386ae0-0ea5-44e0-a02e-161f807af560
curl -X PUT "$LMS_URL/api/v1/lessons/$LESSON_ID" \
-H "X-API-Key: $LMS_KEY" \
-H "Content-Type: application/json" \
-d '{
"completionMode": "MANUAL",
"estimatedMinutes": 30,
"isRequired": true,
"title": "Workplace Safety Essentials",
"unlockMode": "OPEN"
}'const LMS_URL = process.env.LMS_URL
const LMS_KEY = process.env.LMS_KEY
const lessonId = "37386ae0-0ea5-44e0-a02e-161f807af560"
const res = await fetch(`${LMS_URL}/api/v1/lessons/${lessonId}`, {
method: 'PUT',
headers: { "X-API-Key": LMS_KEY, 'Content-Type': 'application/json' },
body: JSON.stringify({
"completionMode": "MANUAL",
"estimatedMinutes": 30,
"isRequired": true,
"title": "Workplace Safety Essentials",
"unlockMode": "OPEN"
}),
})
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 lessonId = "37386ae0-0ea5-44e0-a02e-161f807af560"
const res = await fetch(`${LMS_URL}/api/v1/lessons/${lessonId}`, {
method: 'PUT',
headers: { "X-API-Key": LMS_KEY, 'Content-Type': 'application/json' },
body: JSON.stringify({
"completionMode": "MANUAL",
"estimatedMinutes": 30,
"isRequired": true,
"title": "Workplace Safety Essentials",
"unlockMode": "OPEN"
}),
})
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"]}
lesson_id = "37386ae0-0ea5-44e0-a02e-161f807af560"
res = requests.put(f"{LMS_URL}/api/v1/lessons/{lesson_id}", headers=HEADERS, json={
"completionMode": "MANUAL",
"estimatedMinutes": 30,
"isRequired": True,
"title": "Workplace Safety Essentials",
"unlockMode": "OPEN",
}, 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 lessonId = "37386ae0-0ea5-44e0-a02e-161f807af560";
String body = """
{
"completionMode": "MANUAL",
"estimatedMinutes": 30,
"isRequired": true,
"title": "Workplace Safety Essentials",
"unlockMode": "OPEN"
}
""";
var request = HttpRequest.newBuilder(URI.create(lmsUrl + "/api/v1/lessons/" + lessonId))
.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")
lesson_id = "37386ae0-0ea5-44e0-a02e-161f807af560"
uri = URI("#{lms_url}/api/v1/lessons/#{lesson_id}")
request = Net::HTTP::Put.new(uri, "X-API-Key" => ENV.fetch("LMS_KEY"), "Content-Type" => "application/json")
request.body = {
"completionMode" => "MANUAL",
"estimatedMinutes" => 30,
"isRequired" => true,
"title" => "Workplace Safety Essentials",
"unlockMode" => "OPEN",
}.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');
$lessonId = "37386ae0-0ea5-44e0-a02e-161f807af560";
$ch = curl_init("$lmsUrl/api/v1/lessons/{$lessonId}");
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([
"completionMode" => "MANUAL",
"estimatedMinutes" => 30,
"isRequired" => true,
"title" => "Workplace Safety Essentials",
"unlockMode" => "OPEN",
]),
]);
$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() {
lessonId := "37386ae0-0ea5-44e0-a02e-161f807af560"
body := strings.NewReader(`{
"completionMode": "MANUAL",
"estimatedMinutes": 30,
"isRequired": true,
"title": "Workplace Safety Essentials",
"unlockMode": "OPEN"
}`)
req, _ := http.NewRequest("PUT", os.Getenv("LMS_URL") + "/api/v1/lessons/" + lessonId, 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 lesson
AccessAdmin, or an API key with the write scope.
Deletes the lesson and its blocks. The remaining lessons in the section 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.
LESSON_ID=37386ae0-0ea5-44e0-a02e-161f807af560
curl -X DELETE "$LMS_URL/api/v1/lessons/$LESSON_ID" \
-H "X-API-Key: $LMS_KEY"const LMS_URL = process.env.LMS_URL
const LMS_KEY = process.env.LMS_KEY
const lessonId = "37386ae0-0ea5-44e0-a02e-161f807af560"
const res = await fetch(`${LMS_URL}/api/v1/lessons/${lessonId}`, {
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 lessonId = "37386ae0-0ea5-44e0-a02e-161f807af560"
const res = await fetch(`${LMS_URL}/api/v1/lessons/${lessonId}`, {
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"]}
lesson_id = "37386ae0-0ea5-44e0-a02e-161f807af560"
res = requests.delete(f"{LMS_URL}/api/v1/lessons/{lesson_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 lessonId = "37386ae0-0ea5-44e0-a02e-161f807af560";
var request = HttpRequest.newBuilder(URI.create(lmsUrl + "/api/v1/lessons/" + lessonId))
.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")
lesson_id = "37386ae0-0ea5-44e0-a02e-161f807af560"
uri = URI("#{lms_url}/api/v1/lessons/#{lesson_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');
$lessonId = "37386ae0-0ea5-44e0-a02e-161f807af560";
$ch = curl_init("$lmsUrl/api/v1/lessons/{$lessonId}");
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() {
lessonId := "37386ae0-0ea5-44e0-a02e-161f807af560"
req, _ := http.NewRequest("DELETE", os.Getenv("LMS_URL") + "/api/v1/lessons/" + lessonId, 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
}Move a lesson
AccessAdmin, or an API key with the write scope.
Moves a lesson to another section of the same draft, or to a new position within its own section. position omitted means the end.
Parameters
| Name | In | Type | Notes |
|---|---|---|---|
| idrequired | path | string (uuid) | The id from a previous response. |
Request body application/json · MoveLesson
| Field | Type | Notes |
|---|---|---|
| moduleIdrequired | string (uuid) | — |
| position | integer (int32) | min 0 |
Example request body
{
"moduleId": "311f9b08-25d8-4888-adb1-f2078c368d68",
"position": 0
}Responses
Errors
| Status | When |
|---|---|
| 400 | The target section isn't in the same draft. |
| 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.
LESSON_ID=37386ae0-0ea5-44e0-a02e-161f807af560
curl -X POST "$LMS_URL/api/v1/lessons/$LESSON_ID/move" \
-H "X-API-Key: $LMS_KEY" \
-H "Content-Type: application/json" \
-d '{
"moduleId": "311f9b08-25d8-4888-adb1-f2078c368d68",
"position": 0
}'const LMS_URL = process.env.LMS_URL
const LMS_KEY = process.env.LMS_KEY
const lessonId = "37386ae0-0ea5-44e0-a02e-161f807af560"
const res = await fetch(`${LMS_URL}/api/v1/lessons/${lessonId}/move`, {
method: 'POST',
headers: { "X-API-Key": LMS_KEY, 'Content-Type': 'application/json' },
body: JSON.stringify({
"moduleId": "311f9b08-25d8-4888-adb1-f2078c368d68",
"position": 0
}),
})
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 lessonId = "37386ae0-0ea5-44e0-a02e-161f807af560"
const res = await fetch(`${LMS_URL}/api/v1/lessons/${lessonId}/move`, {
method: 'POST',
headers: { "X-API-Key": LMS_KEY, 'Content-Type': 'application/json' },
body: JSON.stringify({
"moduleId": "311f9b08-25d8-4888-adb1-f2078c368d68",
"position": 0
}),
})
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"]}
lesson_id = "37386ae0-0ea5-44e0-a02e-161f807af560"
res = requests.post(f"{LMS_URL}/api/v1/lessons/{lesson_id}/move", headers=HEADERS, json={
"moduleId": "311f9b08-25d8-4888-adb1-f2078c368d68",
"position": 0,
}, 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 lessonId = "37386ae0-0ea5-44e0-a02e-161f807af560";
String body = """
{
"moduleId": "311f9b08-25d8-4888-adb1-f2078c368d68",
"position": 0
}
""";
var request = HttpRequest.newBuilder(URI.create(lmsUrl + "/api/v1/lessons/" + lessonId + "/move"))
.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")
lesson_id = "37386ae0-0ea5-44e0-a02e-161f807af560"
uri = URI("#{lms_url}/api/v1/lessons/#{lesson_id}/move")
request = Net::HTTP::Post.new(uri, "X-API-Key" => ENV.fetch("LMS_KEY"), "Content-Type" => "application/json")
request.body = {
"moduleId" => "311f9b08-25d8-4888-adb1-f2078c368d68",
"position" => 0,
}.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');
$lessonId = "37386ae0-0ea5-44e0-a02e-161f807af560";
$ch = curl_init("$lmsUrl/api/v1/lessons/{$lessonId}/move");
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([
"moduleId" => "311f9b08-25d8-4888-adb1-f2078c368d68",
"position" => 0,
]),
]);
$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() {
lessonId := "37386ae0-0ea5-44e0-a02e-161f807af560"
body := strings.NewReader(`{
"moduleId": "311f9b08-25d8-4888-adb1-f2078c368d68",
"position": 0
}`)
req, _ := http.NewRequest("POST", os.Getenv("LMS_URL") + "/api/v1/lessons/" + lessonId + "/move", 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
}Add a content block
AccessAdmin, or an API key with the write scope.
A lesson is an ordered list of typed blocks. The shape depends on type:
| type | what to send |
|---|---|
TEXT |
content: { "markdown": "…" } |
VIDEO |
either assetId (an uploaded file) or content: { "url": "https://…" } |
IMAGE |
assetId, and optionally content: { "alt": "…" } |
FILE |
assetId (a downloadable file) |
EMBED |
content: { "url": "https://…", "height": 480 } |
ASSESSMENT |
assessmentId of a quiz in this same draft |
Anything else for a type is rejected. URLs must be https. See Content blocks.
Parameters
| Name | In | Type | Notes |
|---|---|---|---|
| lessonIdrequired | path | string (uuid) | The id from a previous response. |
Request body application/json · BlockCreate
| Field | Type | Notes |
|---|---|---|
| assessmentId | string (uuid) | — |
| assetId | string (uuid) | — |
| content | JsonNode | — |
| position | integer (int32) | min 0 |
| typerequired | string | matches TEXT|VIDEO|FILE|IMAGE|EMBED|ASSESSMENT |
Example request body
{
"type": "TEXT",
"content": {
"markdown": "## Welcome\n\nThis lesson covers what to do when the alarm sounds."
}
}Responses
Example response
{
"id": "37386ae0-0ea5-44e0-a02e-161f807af560"
}Errors
| Status | When |
|---|---|
| 400 | The content doesn't match the block type, a URL isn't https, or an asset or assessment doesn't exist. |
| 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.
LESSON_ID=3d477cf4-98e8-48b4-a056-a98b308b7364
curl -X POST "$LMS_URL/api/v1/lessons/$LESSON_ID/blocks" \
-H "X-API-Key: $LMS_KEY" \
-H "Content-Type: application/json" \
-d '{
"type": "TEXT",
"content": {
"markdown": "## Welcome\n\nThis lesson covers what to do when the alarm sounds."
}
}'const LMS_URL = process.env.LMS_URL
const LMS_KEY = process.env.LMS_KEY
const lessonId = "3d477cf4-98e8-48b4-a056-a98b308b7364"
const res = await fetch(`${LMS_URL}/api/v1/lessons/${lessonId}/blocks`, {
method: 'POST',
headers: { "X-API-Key": LMS_KEY, 'Content-Type': 'application/json' },
body: JSON.stringify({
"type": "TEXT",
"content": {
"markdown": "## Welcome\n\nThis lesson covers what to do when the alarm sounds."
}
}),
})
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 lessonId = "3d477cf4-98e8-48b4-a056-a98b308b7364"
const res = await fetch(`${LMS_URL}/api/v1/lessons/${lessonId}/blocks`, {
method: 'POST',
headers: { "X-API-Key": LMS_KEY, 'Content-Type': 'application/json' },
body: JSON.stringify({
"type": "TEXT",
"content": {
"markdown": "## Welcome\n\nThis lesson covers what to do when the alarm sounds."
}
}),
})
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"]}
lesson_id = "3d477cf4-98e8-48b4-a056-a98b308b7364"
res = requests.post(f"{LMS_URL}/api/v1/lessons/{lesson_id}/blocks", headers=HEADERS, json={
"type": "TEXT",
"content": {
"markdown": "## Welcome\n\nThis lesson covers what to do when the alarm sounds.",
},
}, 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 lessonId = "3d477cf4-98e8-48b4-a056-a98b308b7364";
String body = """
{
"type": "TEXT",
"content": {
"markdown": "## Welcome\\n\\nThis lesson covers what to do when the alarm sounds."
}
}
""";
var request = HttpRequest.newBuilder(URI.create(lmsUrl + "/api/v1/lessons/" + lessonId + "/blocks"))
.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")
lesson_id = "3d477cf4-98e8-48b4-a056-a98b308b7364"
uri = URI("#{lms_url}/api/v1/lessons/#{lesson_id}/blocks")
request = Net::HTTP::Post.new(uri, "X-API-Key" => ENV.fetch("LMS_KEY"), "Content-Type" => "application/json")
request.body = {
"type" => "TEXT",
"content" => {
"markdown" => "## Welcome\n\nThis lesson covers what to do when the alarm sounds.",
},
}.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');
$lessonId = "3d477cf4-98e8-48b4-a056-a98b308b7364";
$ch = curl_init("$lmsUrl/api/v1/lessons/{$lessonId}/blocks");
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([
"type" => "TEXT",
"content" => [
"markdown" => "## Welcome\n\nThis lesson covers what to do when the alarm sounds.",
],
]),
]);
$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() {
lessonId := "3d477cf4-98e8-48b4-a056-a98b308b7364"
body := strings.NewReader(`{
"type": "TEXT",
"content": {
"markdown": "## Welcome\n\nThis lesson covers what to do when the alarm sounds."
}
}`)
req, _ := http.NewRequest("POST", os.Getenv("LMS_URL") + "/api/v1/lessons/" + lessonId + "/blocks", 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 blocks
AccessAdmin, or an API key with the write scope.
Sets the order of a lesson's blocks. ids must list every block exactly once.
Parameters
| Name | In | Type | Notes |
|---|---|---|---|
| lessonIdrequired | 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.
LESSON_ID=3d477cf4-98e8-48b4-a056-a98b308b7364
curl -X POST "$LMS_URL/api/v1/lessons/$LESSON_ID/blocks/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 lessonId = "3d477cf4-98e8-48b4-a056-a98b308b7364"
const res = await fetch(`${LMS_URL}/api/v1/lessons/${lessonId}/blocks/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 lessonId = "3d477cf4-98e8-48b4-a056-a98b308b7364"
const res = await fetch(`${LMS_URL}/api/v1/lessons/${lessonId}/blocks/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"]}
lesson_id = "3d477cf4-98e8-48b4-a056-a98b308b7364"
res = requests.post(f"{LMS_URL}/api/v1/lessons/{lesson_id}/blocks/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 lessonId = "3d477cf4-98e8-48b4-a056-a98b308b7364";
String body = """
{
"ids": [
"37386ae0-0ea5-44e0-a02e-161f807af560"
]
}
""";
var request = HttpRequest.newBuilder(URI.create(lmsUrl + "/api/v1/lessons/" + lessonId + "/blocks/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")
lesson_id = "3d477cf4-98e8-48b4-a056-a98b308b7364"
uri = URI("#{lms_url}/api/v1/lessons/#{lesson_id}/blocks/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');
$lessonId = "3d477cf4-98e8-48b4-a056-a98b308b7364";
$ch = curl_init("$lmsUrl/api/v1/lessons/{$lessonId}/blocks/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() {
lessonId := "3d477cf4-98e8-48b4-a056-a98b308b7364"
body := strings.NewReader(`{
"ids": [
"37386ae0-0ea5-44e0-a02e-161f807af560"
]
}`)
req, _ := http.NewRequest("POST", os.Getenv("LMS_URL") + "/api/v1/lessons/" + lessonId + "/blocks/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
}Rename a section
AccessAdmin, or an API key with the write scope.
Updates the section's title and description. Only sections of a draft can be changed; a published section returns 409.
Parameters
| Name | In | Type | Notes |
|---|---|---|---|
| idrequired | path | string (uuid) | The id from a previous response. |
Request body application/json · ModuleUpdate
| Field | Type | Notes |
|---|---|---|
| description | string | — |
| titlerequired | string | min length 1 |
Example request body
{
"description": "A short description.",
"title": "Workplace Safety Essentials"
}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). |
| 409 | The section belongs to a published or retired version, which is frozen. |
Errors use RFC 9457 problem details.
MODULE_ID=37386ae0-0ea5-44e0-a02e-161f807af560
curl -X PUT "$LMS_URL/api/v1/modules/$MODULE_ID" \
-H "X-API-Key: $LMS_KEY" \
-H "Content-Type: application/json" \
-d '{
"description": "A short description.",
"title": "Workplace Safety Essentials"
}'const LMS_URL = process.env.LMS_URL
const LMS_KEY = process.env.LMS_KEY
const moduleId = "37386ae0-0ea5-44e0-a02e-161f807af560"
const res = await fetch(`${LMS_URL}/api/v1/modules/${moduleId}`, {
method: 'PUT',
headers: { "X-API-Key": LMS_KEY, 'Content-Type': 'application/json' },
body: JSON.stringify({
"description": "A short description.",
"title": "Workplace Safety Essentials"
}),
})
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 moduleId = "37386ae0-0ea5-44e0-a02e-161f807af560"
const res = await fetch(`${LMS_URL}/api/v1/modules/${moduleId}`, {
method: 'PUT',
headers: { "X-API-Key": LMS_KEY, 'Content-Type': 'application/json' },
body: JSON.stringify({
"description": "A short description.",
"title": "Workplace Safety Essentials"
}),
})
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"]}
module_id = "37386ae0-0ea5-44e0-a02e-161f807af560"
res = requests.put(f"{LMS_URL}/api/v1/modules/{module_id}", headers=HEADERS, json={
"description": "A short description.",
"title": "Workplace Safety Essentials",
}, 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 moduleId = "37386ae0-0ea5-44e0-a02e-161f807af560";
String body = """
{
"description": "A short description.",
"title": "Workplace Safety Essentials"
}
""";
var request = HttpRequest.newBuilder(URI.create(lmsUrl + "/api/v1/modules/" + moduleId))
.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")
module_id = "37386ae0-0ea5-44e0-a02e-161f807af560"
uri = URI("#{lms_url}/api/v1/modules/#{module_id}")
request = Net::HTTP::Put.new(uri, "X-API-Key" => ENV.fetch("LMS_KEY"), "Content-Type" => "application/json")
request.body = {
"description" => "A short description.",
"title" => "Workplace Safety Essentials",
}.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');
$moduleId = "37386ae0-0ea5-44e0-a02e-161f807af560";
$ch = curl_init("$lmsUrl/api/v1/modules/{$moduleId}");
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([
"description" => "A short description.",
"title" => "Workplace Safety Essentials",
]),
]);
$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() {
moduleId := "37386ae0-0ea5-44e0-a02e-161f807af560"
body := strings.NewReader(`{
"description": "A short description.",
"title": "Workplace Safety Essentials"
}`)
req, _ := http.NewRequest("PUT", os.Getenv("LMS_URL") + "/api/v1/modules/" + moduleId, 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 section
AccessAdmin, or an API key with the write scope.
Deletes the section and all of its lessons and blocks. Remaining sections 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). |
| 409 | The section belongs to a published or retired version. |
Errors use RFC 9457 problem details.
MODULE_ID=37386ae0-0ea5-44e0-a02e-161f807af560
curl -X DELETE "$LMS_URL/api/v1/modules/$MODULE_ID" \
-H "X-API-Key: $LMS_KEY"const LMS_URL = process.env.LMS_URL
const LMS_KEY = process.env.LMS_KEY
const moduleId = "37386ae0-0ea5-44e0-a02e-161f807af560"
const res = await fetch(`${LMS_URL}/api/v1/modules/${moduleId}`, {
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 moduleId = "37386ae0-0ea5-44e0-a02e-161f807af560"
const res = await fetch(`${LMS_URL}/api/v1/modules/${moduleId}`, {
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"]}
module_id = "37386ae0-0ea5-44e0-a02e-161f807af560"
res = requests.delete(f"{LMS_URL}/api/v1/modules/{module_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 moduleId = "37386ae0-0ea5-44e0-a02e-161f807af560";
var request = HttpRequest.newBuilder(URI.create(lmsUrl + "/api/v1/modules/" + moduleId))
.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")
module_id = "37386ae0-0ea5-44e0-a02e-161f807af560"
uri = URI("#{lms_url}/api/v1/modules/#{module_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');
$moduleId = "37386ae0-0ea5-44e0-a02e-161f807af560";
$ch = curl_init("$lmsUrl/api/v1/modules/{$moduleId}");
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() {
moduleId := "37386ae0-0ea5-44e0-a02e-161f807af560"
req, _ := http.NewRequest("DELETE", os.Getenv("LMS_URL") + "/api/v1/modules/" + moduleId, 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 lesson
AccessAdmin, or an API key with the write scope.
Adds a lesson to a section of a draft.
isRequired(defaulttrue) controls whether it counts towards completion.completionMode:MANUAL(the learner marks it done),VIEWED(opening it is enough) orASSESSMENT_PASSED(passing its quiz completes it).unlockMode:OPEN, orAFTER_PREVIOUS(locked until the nearest earlier required lesson is complete).
Parameters
| Name | In | Type | Notes |
|---|---|---|---|
| moduleIdrequired | path | string (uuid) | The id from a previous response. |
Request body application/json · LessonCreate
| Field | Type | Notes |
|---|---|---|
| completionMode | string | matches MANUAL|VIEWED|ASSESSMENT_PASSED |
| estimatedMinutes | integer (int32) | min 0 |
| isRequired | boolean | — |
| position | integer (int32) | min 0 |
| titlerequired | string | min length 1 |
| unlockMode | string | matches OPEN|AFTER_PREVIOUS |
Example request body
{
"completionMode": "MANUAL",
"estimatedMinutes": 30,
"isRequired": true,
"position": 0,
"title": "Workplace Safety Essentials",
"unlockMode": "OPEN"
}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 section belongs to a published or retired version. |
Errors use RFC 9457 problem details.
MODULE_ID=311f9b08-25d8-4888-adb1-f2078c368d68
curl -X POST "$LMS_URL/api/v1/modules/$MODULE_ID/lessons" \
-H "X-API-Key: $LMS_KEY" \
-H "Content-Type: application/json" \
-d '{
"completionMode": "MANUAL",
"estimatedMinutes": 30,
"isRequired": true,
"position": 0,
"title": "Workplace Safety Essentials",
"unlockMode": "OPEN"
}'const LMS_URL = process.env.LMS_URL
const LMS_KEY = process.env.LMS_KEY
const moduleId = "311f9b08-25d8-4888-adb1-f2078c368d68"
const res = await fetch(`${LMS_URL}/api/v1/modules/${moduleId}/lessons`, {
method: 'POST',
headers: { "X-API-Key": LMS_KEY, 'Content-Type': 'application/json' },
body: JSON.stringify({
"completionMode": "MANUAL",
"estimatedMinutes": 30,
"isRequired": true,
"position": 0,
"title": "Workplace Safety Essentials",
"unlockMode": "OPEN"
}),
})
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 moduleId = "311f9b08-25d8-4888-adb1-f2078c368d68"
const res = await fetch(`${LMS_URL}/api/v1/modules/${moduleId}/lessons`, {
method: 'POST',
headers: { "X-API-Key": LMS_KEY, 'Content-Type': 'application/json' },
body: JSON.stringify({
"completionMode": "MANUAL",
"estimatedMinutes": 30,
"isRequired": true,
"position": 0,
"title": "Workplace Safety Essentials",
"unlockMode": "OPEN"
}),
})
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"]}
module_id = "311f9b08-25d8-4888-adb1-f2078c368d68"
res = requests.post(f"{LMS_URL}/api/v1/modules/{module_id}/lessons", headers=HEADERS, json={
"completionMode": "MANUAL",
"estimatedMinutes": 30,
"isRequired": True,
"position": 0,
"title": "Workplace Safety Essentials",
"unlockMode": "OPEN",
}, 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 moduleId = "311f9b08-25d8-4888-adb1-f2078c368d68";
String body = """
{
"completionMode": "MANUAL",
"estimatedMinutes": 30,
"isRequired": true,
"position": 0,
"title": "Workplace Safety Essentials",
"unlockMode": "OPEN"
}
""";
var request = HttpRequest.newBuilder(URI.create(lmsUrl + "/api/v1/modules/" + moduleId + "/lessons"))
.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")
module_id = "311f9b08-25d8-4888-adb1-f2078c368d68"
uri = URI("#{lms_url}/api/v1/modules/#{module_id}/lessons")
request = Net::HTTP::Post.new(uri, "X-API-Key" => ENV.fetch("LMS_KEY"), "Content-Type" => "application/json")
request.body = {
"completionMode" => "MANUAL",
"estimatedMinutes" => 30,
"isRequired" => true,
"position" => 0,
"title" => "Workplace Safety Essentials",
"unlockMode" => "OPEN",
}.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');
$moduleId = "311f9b08-25d8-4888-adb1-f2078c368d68";
$ch = curl_init("$lmsUrl/api/v1/modules/{$moduleId}/lessons");
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([
"completionMode" => "MANUAL",
"estimatedMinutes" => 30,
"isRequired" => true,
"position" => 0,
"title" => "Workplace Safety Essentials",
"unlockMode" => "OPEN",
]),
]);
$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() {
moduleId := "311f9b08-25d8-4888-adb1-f2078c368d68"
body := strings.NewReader(`{
"completionMode": "MANUAL",
"estimatedMinutes": 30,
"isRequired": true,
"position": 0,
"title": "Workplace Safety Essentials",
"unlockMode": "OPEN"
}`)
req, _ := http.NewRequest("POST", os.Getenv("LMS_URL") + "/api/v1/modules/" + moduleId + "/lessons", 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 lessons
AccessAdmin, or an API key with the write scope.
Sets the order of a section's lessons. ids must list every lesson in the section exactly once.
Parameters
| Name | In | Type | Notes |
|---|---|---|---|
| moduleIdrequired | 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.
MODULE_ID=311f9b08-25d8-4888-adb1-f2078c368d68
curl -X POST "$LMS_URL/api/v1/modules/$MODULE_ID/lessons/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 moduleId = "311f9b08-25d8-4888-adb1-f2078c368d68"
const res = await fetch(`${LMS_URL}/api/v1/modules/${moduleId}/lessons/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 moduleId = "311f9b08-25d8-4888-adb1-f2078c368d68"
const res = await fetch(`${LMS_URL}/api/v1/modules/${moduleId}/lessons/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"]}
module_id = "311f9b08-25d8-4888-adb1-f2078c368d68"
res = requests.post(f"{LMS_URL}/api/v1/modules/{module_id}/lessons/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 moduleId = "311f9b08-25d8-4888-adb1-f2078c368d68";
String body = """
{
"ids": [
"37386ae0-0ea5-44e0-a02e-161f807af560"
]
}
""";
var request = HttpRequest.newBuilder(URI.create(lmsUrl + "/api/v1/modules/" + moduleId + "/lessons/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")
module_id = "311f9b08-25d8-4888-adb1-f2078c368d68"
uri = URI("#{lms_url}/api/v1/modules/#{module_id}/lessons/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');
$moduleId = "311f9b08-25d8-4888-adb1-f2078c368d68";
$ch = curl_init("$lmsUrl/api/v1/modules/{$moduleId}/lessons/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() {
moduleId := "311f9b08-25d8-4888-adb1-f2078c368d68"
body := strings.NewReader(`{
"ids": [
"37386ae0-0ea5-44e0-a02e-161f807af560"
]
}`)
req, _ := http.NewRequest("POST", os.Getenv("LMS_URL") + "/api/v1/modules/" + moduleId + "/lessons/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
}