Guides
Content format
The body of a page is JSON: an array of content nodes. You send this format when you create a page and get it back when you retrieve one.
Nodes
One block or inline node of page content, for example a paragraph, heading or text run. A page's content is the list of its top-level nodes, in order. A node has these fields:
| Field | Description |
|---|---|
typestringrequired | The node type, such as |
attrsobjectoptional | Type-specific attributes, such as a heading |
contentContentNode[]optional | Child nodes. |
textstringoptional | The text of a |
marksobject[]optional | Inline formatting on a |
Blocks such as paragraphs, headings and lists hold other nodes in content. The text itself sits in nodes of type text, which have a text string instead of children.
Blocks
Paragraph
A paragraph contains text nodes.
{
"type": "paragraph",
"content": [
{
"type": "text",
"text": "Steps we follow for every release."
}
]
}Heading
A heading contains text nodes and sets its level in attrs.level.
{
"type": "heading",
"attrs": {
"level": 2
},
"content": [
{
"type": "text",
"text": "Before the release"
}
]
}Bulleted list
A bulletList contains listItem nodes. Each list item contains blocks, usually one paragraph.
{
"type": "bulletList",
"content": [
{
"type": "listItem",
"content": [
{
"type": "paragraph",
"content": [
{
"type": "text",
"text": "Update the changelog"
}
]
}
]
},
{
"type": "listItem",
"content": [
{
"type": "paragraph",
"content": [
{
"type": "text",
"text": "Tag the release"
}
]
}
]
}
]
}Marks
Inline formatting is a list of marks on a text node. To format part of a sentence, split it into several text nodes and put the marks on the ones they apply to.
Bold
{
"type": "text",
"text": "every",
"marks": [
{
"type": "bold"
}
]
}Link
A link mark carries its address in attrs.href.
{
"type": "text",
"text": "release notes",
"marks": [
{
"type": "link",
"attrs": {
"href": "https://example.com/release-notes"
}
}
]
}A full example
This request to post/v1/pages creates a page with a paragraph that has bold text and a link, a heading and a bulleted list.
curl -X POST "https://api.slimwiki.com/v1/pages" \
-H "Authorization: Bearer $SLIMWIKI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"wiki_id": "6f1c2d0e-8a3b-4c5d-9e7f-0a1b2c3d4e5f",
"title": "Release checklist",
"content": [
{
"type": "paragraph",
"content": [
{
"type": "text",
"text": "Steps we follow for "
},
{
"type": "text",
"text": "every",
"marks": [
{
"type": "bold"
}
]
},
{
"type": "text",
"text": " release. See the "
},
{
"type": "text",
"text": "release notes",
"marks": [
{
"type": "link",
"attrs": {
"href": "https://example.com/release-notes"
}
}
]
},
{
"type": "text",
"text": "."
}
]
},
{
"type": "heading",
"attrs": {
"level": 2
},
"content": [
{
"type": "text",
"text": "Before the release"
}
]
},
{
"type": "bulletList",
"content": [
{
"type": "listItem",
"content": [
{
"type": "paragraph",
"content": [
{
"type": "text",
"text": "Update the changelog"
}
]
}
]
},
{
"type": "listItem",
"content": [
{
"type": "paragraph",
"content": [
{
"type": "text",
"text": "Tag the release"
}
]
}
]
}
]
}
]
}'Reading and updating content
get/v1/pages/{page_id} returns a page with its content. The endpoints that list or search pages do not include content; retrieve a page to get it.
Content you read back can contain node types and marks that this guide does not cover. Skip the ones your code does not handle.