Create a course by pasting JSON
The course JSON format: create a draft course from a pasted document, replace a draft's modules and lessons, or export a course.
A course can be written as one JSON document and pasted into Magpie: the text of its course page, its modules, and its lessons with their quizzes and assignments. New course → Paste JSON will create a draft course from it. On a draft course, More → Import JSON… will replace the course's modules and lessons with the ones in the document. Export as JSON, in any course's More menu, will download the course in the same format. An export will import back as a new draft course with the same outline.
Use Copy the prompt in the import box to copy these instructions for an assistant you use. The assistant will ask you for what it needs, then write the document.
Importing is all or nothing. Magpie will check the whole document before it saves anything, and will name a mistake by its place in the document, such as "modules[1].lessons[0].title" is required and cannot be empty. A field that is not in the format is refused, and so is a field for another kind of lesson, such as questions on a lesson whose kind is "lesson". A document can be up to 1 MB.
An imported course is a draft, and so is every imported lesson. Students will see a lesson once you publish it and the course; Get started with Courses says how a course is put together and published.
The document never contains students, cohorts, prices, videos, audio or files; add them to the course after the import. A line in a lesson's text that shows a video, @[video](…), will be left out of an export and removed from an import. A picture in any text of the document is written as  with the picture's address in your image library; an address that is not in your image library is refused, and the message names where it is. A question's own picture, chosen in the lesson editor, is not part of the document.
Replacing a draft's outline
Import JSON… is in the More menu of a draft course. Every module and lesson in the draft will be replaced by the ones in the document, and every new lesson will be a draft. The files on the current lessons will be deleted, and so will their videos, except a video another lesson uses. A live session's meeting and its Calendar event will be removed with its lesson. The course's title, subtitle, description, audience, outcomes, questions and answers, mode and time zone will change only where the document has them. The mode can change only while no student has enrolled and the course has no cohorts.
Only a draft can be replaced. To change the outline of a published course, use More → Duplicate course and import into the copy, which is a draft.
The document
{
"schema": "magpie.course",
"version": 1,
"title": "Pricing your freelance work",
"subtitle": "Set prices clients accept and you can live on",
"description": "Six short modules on working out a rate, writing a quote and holding your price.",
"audience": "Freelance designers, writers and developers in their first three years.",
"outcomes": ["Work out a day rate from what you need to earn", "Write a quote with three options"],
"faq": [{ "question": "How long does it take?", "answer": "About four hours over two weeks." }],
"mode": "self_paced",
"modules": [
{
"title": "Your number",
"availability": { "rule": "now" },
"lessons": [
{ "kind": "lesson", "title": "What you need to earn", "minutes": 12, "freePreview": true,
"body": "Start from the year, not the hour.\n\n1. Add up what you spend in a year..." },
{ "kind": "quiz", "title": "Check your number", "passPercent": 80, "attempts": null, "showAfter": "explanations",
"questions": [
{ "kind": "single", "prompt": "Which comes first?", "points": 1,
"options": [ { "text": "Your yearly costs", "correct": true }, { "text": "Your competitors' rates", "correct": false } ],
"explanation": "Your costs set the lowest price you can accept." }
] }
]
},
{
"title": "Quoting",
"availability": { "rule": "after_days", "days": 7 },
"lessons": [
{ "kind": "assignment", "title": "Write your first quote", "submit": ["text", "files"], "reviewRequired": true,
"body": "Write a quote for the brief below and upload it as a PDF." }
]
}
]
}
The course
| Field | Type | Notes |
|---|---|---|
schema |
string, optional | "magpie.course". |
version |
number, optional | 1. |
title |
string, required | Up to 200 characters. |
subtitle |
string, optional | A line under the title on the course page, up to 300 characters. |
description |
string, optional | What the course is about, in Markdown, up to 20,000 characters. |
audience |
string, optional | Who the course is for, in Markdown, up to 20,000 characters. |
outcomes |
array of strings, optional | What students will be able to do at the end: up to 12, each up to 200 characters. |
faq |
array, optional | Questions and answers for the course page, up to 20. Each is { "question", "answer" }, both required: a question up to 300 characters and an answer in Markdown, up to 2,000 characters. |
mode |
string, optional | "self_paced", where each student starts when they enrol, or "cohort", where students start together in cohorts with dates. "self_paced" if left out. |
timezone |
string, optional | A time zone name such as Europe/London, used for lessons that open on a date. The Time zone for new courses in Courses settings if left out. |
modules |
array, required | The course's modules in order, up to 100. [] makes a course with no modules yet. |
Modules
| Field | Type | Notes |
|---|---|---|
title |
string, required | Up to 200 characters. |
availability |
object, optional | When the module's lessons open, as below. At once if left out. |
lessons |
array, optional | The module's lessons in order. A course can have up to 500 lessons across all its modules. |
When a module or lesson opens
availability is an object with these fields:
| Field | Type | Notes |
|---|---|---|
rule |
string, optional | "now" (at once), "after_days" (a number of days after the student starts) or "on_date" (on a date and time). "now" if left out. |
days |
number | Required for "after_days": 0 to 3,650. The days are counted from each student's enrolment, or in a cohort course from the cohort's first day. |
date |
string | Required for "on_date": the date, written as YYYY-MM-DD. |
time |
string, optional | For "on_date": the time on the clock in the course's timezone, written as HH:MM in 24 hours. "09:00" if left out. A time that a clock change skips is refused. |
days is used only with "after_days", and date and time only with "on_date"; with another rule they are refused. A lesson's own availability replaces its module's. A lesson without one opens with its module.
Lessons
Every lesson has these fields:
| Field | Type | Notes |
|---|---|---|
kind |
string, optional | "lesson", "quiz", "assignment" or "live" (a live session). "lesson" if left out. |
title |
string, required | Up to 200 characters. The lesson's address is made from it. |
body |
string, optional | The lesson's text in Markdown, up to 200,000 characters. For an assignment, it is the brief. |
minutes |
number, optional | How long the lesson takes, in minutes: 1 to 600. For a live session, the session's length: 15 to 600, and 60 if left out. |
freePreview |
boolean, optional | true opens the lesson to everyone, enrolled or not, once it is published. false if left out. |
required |
boolean, optional | false makes the lesson optional: it does not count toward a student's progress. true if left out. |
availability |
object, optional | When the lesson opens, as above. Like its module if left out. |
A quiz and an assignment take more fields, below. A lesson whose kind is "lesson" or "live" takes only the fields above.
Quizzes
A lesson whose kind is "quiz" also takes:
| Field | Type | Notes |
|---|---|---|
passPercent |
number, optional | The score a student needs to pass, as a percentage from 1 to 100. Without one, the quiz is complete when submitted. |
attempts |
number, optional | How many times a student can take the quiz: 1 to 20. Unlimited if left out or null. |
shuffle |
boolean, optional | true shows the questions and their options in a new order on each attempt. false if left out. |
showAfter |
string, optional | What a student sees after submitting: "score" (their score), "answers" (their score and which answers were right) or "explanations" (their score, the right answers and the explanations). "score" if left out. |
timeLimitMinutes |
number, optional | A time limit for each attempt, 1 to 600 minutes. An open attempt is submitted as it stands when the time runs out. No limit if left out. |
questions |
array, optional | The questions in order, up to 200. |
Each question:
| Field | Type | Notes |
|---|---|---|
kind |
string, optional | "single" (one right answer), "multiple" (several right answers), "true_false" or "short" (a short typed answer). "single" if left out. |
prompt |
string, required | The question, in Markdown, up to 5,000 characters. |
points |
number, optional | 1 to 100. 1 if left out. A "multiple" question earns its points only when every right option and no wrong one is chosen. |
options |
array | Required for "single" and "multiple": 2 to 10 options, each { "text", "correct" } and each with different text. text is required, up to 500 characters, and correct is true for a right answer. A "single" question has exactly one right option; a "multiple" question has at least one. |
answer |
boolean | Required for "true_false": the right answer, true or false. |
accepted |
array of strings | Required for "short": the answers that count as right, 1 to 20, each up to 200 characters. Capitals and extra spaces do not count when an answer is marked. |
explanation |
string, optional | Shown after the student submits, when the quiz shows explanations. Markdown, up to 5,000 characters. |
To replace only a quiz's questions later, see Replace a quiz's questions by pasting JSON.
Assignments
A lesson whose kind is "assignment" also takes:
| Field | Type | Notes |
|---|---|---|
submit |
array of strings, optional | What students submit: ["text"], ["files"] or ["text", "files"]. ["text"] if left out. |
reviewRequired |
boolean, optional | true: each submission waits in To review until an instructor approves it or asks for changes. false: the lesson is complete when submitted. true if left out. |
holdUntilApproved |
boolean, optional | true: with Lessons in order on, the next lesson waits for approval instead of opening on submission. false if left out. |
dueDays |
number, optional | When it is due: 1 to 365 days after the lesson opens for the student, or in a cohort course, the day of the cohort it is due on. No due date if left out. |
Live sessions
A lesson whose kind is "live" takes the lesson fields only, with minutes as the session's length. Its time, and whether it takes place on Zoom, in Video Chat or at an address, are set in the lesson editor after the import. In a cohort course, each cohort's time is set on that cohort's page.
If an import is rejected for a reason you cannot work out, Contact support.
Den Magpie-Support fragen
Senden Sie dem Magpie-Team eine Frage zu allem, was dieser Artikel nicht beantwortet.