Import a course package
Import a course made of readings, a checklist and a quiz, then confirm it in the catalogue.
Build the package
Give the course a new ID and each lesson a distinct ID within the course. Put the plain text of a reading in body, the points of a checklist in items, and the questions of the quiz in questions with passingAnswers and maxAttempts. List the lessons in the order learners take them, with the quiz last, and give each its minutes. Send the JSON with revision zero and a fresh operation UUID.
curl
curl -X POST "$RDC_BASE_URL/elearning/v1/course-packages" \
-H "Authorization: Bearer $RDC_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"operationId": "4e08713a-ec34-4a5a-92d3-81fd42564001",
"expectedRevision": 0,
"id": "receiving-review",
"title": "Receiving review",
"validityDays": 365,
"lessons": [
{
"id": "delivery-note",
"kind": "reading",
"minutes": 2,
"title": "Check the note",
"body": "Match the delivery note against the purchase order before accepting the delivery.\n\nKeep damaged goods in the receiving area and tell purchasing the same day."
},
{
"id": "delivery-checklist",
"kind": "checklist",
"minutes": 1,
"title": "Before you accept",
"items": [
"Match the note and the order.",
"Count and inspect the cases.",
"Record the discrepancy before put-away."
]
},
{
"id": "delivery-quiz",
"kind": "quiz",
"minutes": 2,
"title": "Delivery quiz",
"maxAttempts": 3,
"passingAnswers": 2,
"questions": [
{
"prompt": "What do you match against the purchase order?",
"choices": [
"Delivery note",
"Shelf label"
],
"correct": 0
},
{
"prompt": "Where do damaged cases stay?",
"choices": [
"On the picking shelf",
"In the receiving area"
],
"correct": 1
},
{
"prompt": "When do you put away the accepted quantity?",
"choices": [
"After recording it",
"Before counting it"
],
"correct": 0
}
]
}
]
}' JavaScript
const response = await fetch(`${process.env.RDC_BASE_URL}/elearning/v1/course-packages`, {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.RDC_TOKEN}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"operationId": "4e08713a-ec34-4a5a-92d3-81fd42564001",
"expectedRevision": 0,
"id": "receiving-review",
"title": "Receiving review",
"validityDays": 365,
"lessons": [
{
"id": "delivery-note",
"kind": "reading",
"minutes": 2,
"title": "Check the note",
"body": "Match the delivery note against the purchase order before accepting the delivery.\n\nKeep damaged goods in the receiving area and tell purchasing the same day."
},
{
"id": "delivery-checklist",
"kind": "checklist",
"minutes": 1,
"title": "Before you accept",
"items": [
"Match the note and the order.",
"Count and inspect the cases.",
"Record the discrepancy before put-away."
]
},
{
"id": "delivery-quiz",
"kind": "quiz",
"minutes": 2,
"title": "Delivery quiz",
"maxAttempts": 3,
"passingAnswers": 2,
"questions": [
{
"prompt": "What do you match against the purchase order?",
"choices": [
"Delivery note",
"Shelf label"
],
"correct": 0
},
{
"prompt": "Where do damaged cases stay?",
"choices": [
"On the picking shelf",
"In the receiving area"
],
"correct": 1
},
{
"prompt": "When do you put away the accepted quantity?",
"choices": [
"After recording it",
"Before counting it"
],
"correct": 0
}
]
}
]
}),
});
const result = await response.json(); Python
import os
import requests
response = requests.request(
'POST',
f'{os.environ["RDC_BASE_URL"]}/elearning/v1/course-packages',
headers={
'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
},
json={
'operationId': '4e08713a-ec34-4a5a-92d3-81fd42564001',
'expectedRevision': 0,
'id': 'receiving-review',
'title': 'Receiving review',
'validityDays': 365,
'lessons': [
{
'id': 'delivery-note',
'kind': 'reading',
'minutes': 2,
'title': 'Check the note',
'body': 'Match the delivery note against the purchase order before accepting the delivery.
Keep damaged goods in the receiving area and tell purchasing the same day.',
},
{
'id': 'delivery-checklist',
'kind': 'checklist',
'minutes': 1,
'title': 'Before you accept',
'items': [
'Match the note and the order.',
'Count and inspect the cases.',
'Record the discrepancy before put-away.',
],
},
{
'id': 'delivery-quiz',
'kind': 'quiz',
'minutes': 2,
'title': 'Delivery quiz',
'maxAttempts': 3,
'passingAnswers': 2,
'questions': [
{
'prompt': 'What do you match against the purchase order?',
'choices': [
'Delivery note',
'Shelf label',
],
'correct': 0,
},
{
'prompt': 'Where do damaged cases stay?',
'choices': [
'On the picking shelf',
'In the receiving area',
],
'correct': 1,
},
{
'prompt': 'When do you put away the accepted quantity?',
'choices': [
'After recording it',
'Before counting it',
],
'correct': 0,
},
],
},
],
},
)
result = response.json() PHP
<?php
$body = <<<'JSON'
{
"operationId": "4e08713a-ec34-4a5a-92d3-81fd42564001",
"expectedRevision": 0,
"id": "receiving-review",
"title": "Receiving review",
"validityDays": 365,
"lessons": [
{
"id": "delivery-note",
"kind": "reading",
"minutes": 2,
"title": "Check the note",
"body": "Match the delivery note against the purchase order before accepting the delivery.\n\nKeep damaged goods in the receiving area and tell purchasing the same day."
},
{
"id": "delivery-checklist",
"kind": "checklist",
"minutes": 1,
"title": "Before you accept",
"items": [
"Match the note and the order.",
"Count and inspect the cases.",
"Record the discrepancy before put-away."
]
},
{
"id": "delivery-quiz",
"kind": "quiz",
"minutes": 2,
"title": "Delivery quiz",
"maxAttempts": 3,
"passingAnswers": 2,
"questions": [
{
"prompt": "What do you match against the purchase order?",
"choices": [
"Delivery note",
"Shelf label"
],
"correct": 0
},
{
"prompt": "Where do damaged cases stay?",
"choices": [
"On the picking shelf",
"In the receiving area"
],
"correct": 1
},
{
"prompt": "When do you put away the accepted quantity?",
"choices": [
"After recording it",
"Before counting it"
],
"correct": 0
}
]
}
]
}
JSON;
$curl = curl_init(getenv('RDC_BASE_URL') . '/elearning/v1/course-packages');
curl_setopt_array($curl, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('RDC_TOKEN'),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => $body,
]);
$result = json_decode(curl_exec($curl), true);
curl_close($curl); C#
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/elearning/v1/course-packages");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
"operationId": "4e08713a-ec34-4a5a-92d3-81fd42564001",
"expectedRevision": 0,
"id": "receiving-review",
"title": "Receiving review",
"validityDays": 365,
"lessons": [
{
"id": "delivery-note",
"kind": "reading",
"minutes": 2,
"title": "Check the note",
"body": "Match the delivery note against the purchase order before accepting the delivery.\n\nKeep damaged goods in the receiving area and tell purchasing the same day."
},
{
"id": "delivery-checklist",
"kind": "checklist",
"minutes": 1,
"title": "Before you accept",
"items": [
"Match the note and the order.",
"Count and inspect the cases.",
"Record the discrepancy before put-away."
]
},
{
"id": "delivery-quiz",
"kind": "quiz",
"minutes": 2,
"title": "Delivery quiz",
"maxAttempts": 3,
"passingAnswers": 2,
"questions": [
{
"prompt": "What do you match against the purchase order?",
"choices": [
"Delivery note",
"Shelf label"
],
"correct": 0
},
{
"prompt": "Where do damaged cases stay?",
"choices": [
"On the picking shelf",
"In the receiving area"
],
"correct": 1
},
{
"prompt": "When do you put away the accepted quantity?",
"choices": [
"After recording it",
"Before counting it"
],
"correct": 0
}
]
}
]
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync(); {
"operationId": "4e08713a-ec34-4a5a-92d3-81fd42564001",
"status": "accepted",
"aggregateRevision": null
} Poll the operation with your UUID. When it completes, look for the new ID in the catalogue before assigning it: the course appears with its lessons and the total of their minutes. If rejected, use the returned code to correct the package and submit it as a new operation.
curl
curl "$RDC_BASE_URL/elearning/v1/courses" \
-H "Authorization: Bearer $RDC_TOKEN" JavaScript
const response = await fetch(`${process.env.RDC_BASE_URL}/elearning/v1/courses`, {
method: 'GET',
headers: {
Authorization: `Bearer ${process.env.RDC_TOKEN}`,
},
});
const result = await response.json(); Python
import os
import requests
response = requests.request(
'GET',
f'{os.environ["RDC_BASE_URL"]}/elearning/v1/courses',
headers={
'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
},
)
result = response.json() PHP
<?php
$curl = curl_init(getenv('RDC_BASE_URL') . '/elearning/v1/courses');
curl_setopt_array($curl, [
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('RDC_TOKEN'),
],
]);
$result = json_decode(curl_exec($curl), true);
curl_close($curl); C#
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Get, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/elearning/v1/courses");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync(); {
"items": [
{
"id": "receiving-goods",
"title": "Receiving goods",
"kind": "course",
"lessonIds": [
"receiving-reading",
"receiving-checklist",
"receiving-quiz"
],
"courseIds": [],
"durationMinutes": 5,
"validityDays": 365
},
{
"id": "workplace-safety",
"title": "Workplace safety",
"kind": "course",
"lessonIds": [
"safety-reading",
"safety-quiz"
],
"courseIds": [],
"durationMinutes": 4,
"validityDays": 365
},
{
"id": "new-hire-onboarding",
"title": "New-hire onboarding",
"kind": "path",
"lessonIds": [],
"courseIds": [
"workplace-safety",
"receiving-goods"
],
"durationMinutes": 9
},
{
"id": "receiving-review",
"title": "Receiving review",
"kind": "course",
"lessonIds": [
"delivery-note",
"delivery-checklist",
"delivery-quiz"
],
"courseIds": [],
"durationMinutes": 5,
"validityDays": 365
}
],
"nextCursor": null
}