Needs the quiz:write scope.
Rich text (blocks[].content) is HTML in a closed format: p, h1 to h3, br, strong, em, u, s, sup, sub, code, a (href), span (style color, background-color), text-align on p and h1 to h3, ul, ol, li (data-checked), table rows and cells, pre with code, blockquote, hr, details with summary, figure with figcaption, and
Intro
Read this first.
Set text_format to “markdown” to write Markdown instead.Call
- Tool:
create_quiz - Scope:
quiz:write - Writes, and may change or remove what is there.
- Acts on a store.
Arguments
| Name | Type | Required | Description |
|---|---|---|---|
store |
string |
No | The store to act on. |
text_format |
"html" or "markdown" |
No | The format the rich text fields are written in: the rich text format’s HTML, or Markdown converted into it before it is validated. A text already stored in the format (starting with <rich-text) is kept as it is either way. |
product |
object |
Yes | |
full |
true |
No | Answers the texts, attachments and file lists the short answer leaves out. |
entry |
object |
Yes | |
after |
object or null |
No | The newest version the caller started from, null for none; a newer one refuses the write. |
follows |
object |
No | The questions that version held as the caller read them; others there refuse the write. |
blocks |
array of object |
Yes | The blocks as the editor writes them; a key the schema does not know is refused. |
title |
string or null |
No | |
settings |
object |
No |
{
"type": "object",
"properties": {
"store": {
"type": "string",
"description": "The store to act on."
},
"text_format": {
"type": "string",
"enum": [
"html",
"markdown"
],
"default": "html",
"description": "The format the rich text fields are written in: the rich text format’s HTML, or Markdown converted into it before it is validated. A text already stored in the format (starting with `<rich-text`) is kept as it is either way."
},
"product": {
"anyOf": [
{
"type": "object",
"properties": {
"id": {
"type": "string",
"minLength": 1,
"maxLength": 512
}
},
"required": [
"id"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"slug": {
"type": "string",
"minLength": 1,
"maxLength": 512
}
},
"required": [
"slug"
],
"additionalProperties": false
}
]
},
"full": {
"description": "Answers the texts, attachments and file lists the short answer leaves out.",
"type": "boolean",
"const": true
},
"entry": {
"type": "object",
"properties": {
"id": {
"type": "string",
"minLength": 1,
"maxLength": 512
}
},
"required": [
"id"
],
"additionalProperties": false
},
"after": {
"description": "The newest version the caller started from, null for none; a newer one refuses the write.",
"anyOf": [
{
"type": "object",
"properties": {
"id": {
"type": "string",
"minLength": 1,
"maxLength": 512
}
},
"required": [
"id"
],
"additionalProperties": false
},
{
"type": "null"
}
]
},
"follows": {
"description": "The questions that version held as the caller read them; others there refuse the write.",
"type": "object",
"properties": {
"id": {
"type": "string",
"minLength": 1,
"maxLength": 512
}
},
"required": [
"id"
],
"additionalProperties": false
},
"blocks": {
"description": "The blocks as the editor writes them; a key the schema does not know is refused.",
"type": "array",
"items": {
"anyOf": [
{
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "multiple_choice"
},
"id": {
"type": "string"
},
"question": {
"type": "string"
},
"options": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"text": {
"type": "string"
}
},
"required": [
"id",
"text"
],
"additionalProperties": false
},
"minItems": 2,
"maxItems": 100
},
"correctOptionId": {
"type": "string"
},
"weight": {
"type": "number"
},
"hint": {
"type": "string"
},
"explanation": {
"type": "string"
}
},
"required": [
"type",
"id",
"question",
"options",
"correctOptionId",
"weight"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "scale"
},
"id": {
"type": "string"
},
"question": {
"type": "string"
},
"min": {
"type": "number"
},
"max": {
"type": "number"
},
"correctValue": {
"type": "number"
},
"weight": {
"type": "number"
},
"hint": {
"type": "string"
},
"explanation": {
"type": "string"
}
},
"required": [
"type",
"id",
"question",
"min",
"max",
"correctValue",
"weight"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "static_text"
},
"id": {
"type": "string"
},
"content": {
"description": "The text a sitter reads, in the rich text format with the blocks a lesson takes, showing a reader at most 500 characters (UTF-16 units).",
"type": "string",
"x-rich-text": "text"
}
},
"required": [
"type",
"id",
"content"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "section_break"
},
"id": {
"type": "string"
}
},
"required": [
"type",
"id"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "separator"
},
"id": {
"type": "string"
}
},
"required": [
"type",
"id"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "true_false"
},
"id": {
"type": "string"
},
"question": {
"type": "string"
},
"correctAnswer": {
"type": "boolean"
},
"weight": {
"type": "number"
},
"hint": {
"type": "string"
},
"explanation": {
"type": "string"
}
},
"required": [
"type",
"id",
"question",
"correctAnswer",
"weight"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "short_text"
},
"id": {
"type": "string"
},
"question": {
"type": "string"
},
"acceptedAnswers": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"text": {
"type": "string"
}
},
"required": [
"id",
"text"
],
"additionalProperties": false
},
"minItems": 1,
"maxItems": 100
},
"weight": {
"type": "number"
},
"hint": {
"type": "string"
},
"explanation": {
"type": "string"
}
},
"required": [
"type",
"id",
"question",
"acceptedAnswers",
"weight"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "free_text"
},
"id": {
"type": "string"
},
"question": {
"type": "string"
}
},
"required": [
"type",
"id",
"question"
],
"additionalProperties": false
}
]
},
"minItems": 1,
"maxItems": 50
},
"title": {
"anyOf": [
{
"type": "string",
"minLength": 1,
"maxLength": 200
},
{
"type": "null"
}
]
},
"settings": {
"type": "object",
"properties": {
"attempts_allowed": {
"description": "Null is unlimited.",
"anyOf": [
{
"type": "integer",
"minimum": 1,
"maximum": 1000
},
{
"type": "null"
}
]
},
"pass_mark": {
"description": "Percent needed to pass; null passes any finished sitting.",
"anyOf": [
{
"type": "integer",
"minimum": 0,
"maximum": 100
},
{
"type": "null"
}
]
},
"show_answers": {
"type": "boolean"
}
},
"additionalProperties": false
}
},
"required": [
"product",
"entry",
"blocks"
],
"additionalProperties": false
}Answer
| Name | Type | Required | Description |
|---|---|---|---|
id |
string |
Yes | |
created_at |
string or null |
Yes | |
updated_at |
string or null |
Yes | |
settings |
object |
Yes | |
product_id |
string |
Yes | |
entry_id |
string |
Yes | |
version |
number |
Yes | |
certificates |
array of object |
Yes | |
question_count |
number |
Yes | How many of its blocks are questions a sitter answers. |
sittings |
number |
Yes | |
body |
object |
Yes | |
files |
object |
No | The files its static text names, as its save bound them; answered only with full. |
created |
array of object |
Yes | The attachments the write bound: the files its new static text names. |
The answer’s full shape is on its API reference page.
Errors
A refused call is a tool error. Its structuredContent holds a code and its context, except for client-fault. This tool may answer:
invalid: an argument is malformed;context.pathnames it.invalidat["store"]:storeis missing while the connection reaches more than one store, or names a store it doesn’t reach.not_found: nothing matches a reference given.conflict: the call clashes with the current state;contextnames the field and, where it helps, its current value, and for afrom,live,expector version that no longer matches, the argument (path) and what it takes (reason).not_permitted: this connection may not make this call. Whencontext.reasonislimit, too many calls:retry_aftersays when to try again.internalorunavailable: the call failed inside Sherpo, and the write may have landed. This write takes no idempotency key, so read the state back before trying again.client-fault: the server failed around the call.core_answerokmeans the write landed, so don’t send it again. Whenreached_coreis false, nothing happened and the call may be made again. Otherwise, this write takes no idempotency key, so read the state back before trying again.- HTTP 403 with
insufficient_scope: the connection lacks the scope this tool needs. - HTTP 401 with
invalid_token: the access token expired or the connection ended. Refresh the token, and connect again if the refresh fails or the new token is refused too.
Any other code may come back too, such as a conflict when the state changed under the call. When the answer was already streaming, a 401 or 403 comes back as a tool error with only its text. See Errors for every code and its context.