墨问 API
  1. 说明
墨问 API
  • 说明
    • 1. 概述
    • 2. NoteAtom 的结构说明
    • 3. 错误码
    • 4. ChangeLog
  • 授权
    • APIKey 重置
      POST
  • 笔记
    • 笔记创建
      POST
    • 笔记编辑
      POST
    • 笔记设置
      POST
  1. 说明

2. NoteAtom 的结构说明

NoteAtom 结构#

NoteAtom
笔记-原子节点信息
type
string 
可选
节点类型: 必填
根节点(顶层节点必须是根节点): doc
段落(block): paragraph
文本(inline): text
高亮(marks): highlight
链接(marks): link
加粗(marks): bold
引用(block): quote
内链笔记(block): note
text
string 
可选
节点文本: 非必填
通常用在 text 类型的节点中
content
array[object (NoteAtom) {5}] 
可选
节点内容: 非必填
通常用在 block 类型的节点中
type
string 
可选
节点类型: 必填
根节点(顶层节点必须是根节点): doc
段落(block): paragraph
文本(inline): text
高亮(marks): highlight
链接(marks): link
加粗(marks): bold
引用(block): quote
内链笔记(block): note
text
string 
可选
节点文本: 非必填
通常用在 text 类型的节点中
content
array[object (NoteAtom) {5}] 
可选
节点内容: 非必填
通常用在 block 类型的节点中
marks
array[object (NoteAtom) {5}] 
可选
节点标记: 非必填
通常用在 inline 类型的节点中,用于描述样式
attrs
object 
可选
节点属性: 非必填
与各种节点配合使用,用于描述属性信息
href: 链接地址,用于 marks.link 类型的节点
uuid: 内链笔记的笔记 ID,用于 note 类型的节点
marks
array[object (NoteAtom) {5}] 
可选
节点标记: 非必填
通常用在 inline 类型的节点中,用于描述样式
type
string 
可选
节点类型: 必填
根节点(顶层节点必须是根节点): doc
段落(block): paragraph
文本(inline): text
高亮(marks): highlight
链接(marks): link
加粗(marks): bold
引用(block): quote
内链笔记(block): note
text
string 
可选
节点文本: 非必填
通常用在 text 类型的节点中
content
array[object (NoteAtom) {5}] 
可选
节点内容: 非必填
通常用在 block 类型的节点中
marks
array[object (NoteAtom) {5}] 
可选
节点标记: 非必填
通常用在 inline 类型的节点中,用于描述样式
attrs
object 
可选
节点属性: 非必填
与各种节点配合使用,用于描述属性信息
href: 链接地址,用于 marks.link 类型的节点
uuid: 内链笔记的笔记 ID,用于 note 类型的节点
attrs
object 
可选
节点属性: 非必填
与各种节点配合使用,用于描述属性信息
href: 链接地址,用于 marks.link 类型的节点
uuid: 内链笔记的笔记 ID,用于 note 类型的节点
额外字段
string 
可选

说明#

NoteAtom 是笔记的原子结构。一个 NoteAtom 节点,可以包含其他的NoteAtom 节点,以一个树状的结构来描述一篇笔记。
NoteAtom 可以包含如下属性:
属性类型说明
typestring表示当前 atom 节点的类型,可能包含 doc(一篇笔记) paragraph(笔记中的段落) text(段落中的文本) 等类型。⚠️ 根节点的 type 必须是 doc
textstring节点的文本内容
marks[]NoteAtom由多个atom节点组成,通常用来修饰 text 文本的样式,如高亮 加粗 链接
attrsmap<string>string节点的属性
content[]NoteAtom当前节点的子节点,由多个atom节点组成。譬如一个doc 节点包含多个 paragraph 节点, paragraph 又可以包含多个 text 节点

举例#

{
    "body": {
        "type": "doc",
        "content": [
            {
                "type": "paragraph",
                "content": [
                    {
                        "type": "text",
                        "text": "这是一条 API 创建的笔记"
                    }
                ]
            },
            {
                "type": "paragraph"
            },
            {
                "type": "paragraph",
                "content": [
                    {
                        "type": "text",
                        "text": "第一段,普通文本段落"
                    }
                ]
            },
            {
                "type": "paragraph"
            },
            {
                "type": "paragraph",
                "content": [
                    {
                        "type": "text",
                        "text": "第二段,富文本段落 "
                    },
                    {
                        "type": "text",
                        "marks": [
                            {
                                "type": "bold"
                            }
                        ],
                        "text": "加粗"
                    },
                    {
                        "type": "text",
                        "text": " "
                    },
                    {
                        "type": "text",
                        "marks": [
                            {
                                "type": "highlight"
                            }
                        ],
                        "text": "高亮"
                    },
                    {
                        "type": "text",
                        "text": " "
                    },
                    {
                        "type": "text",
                        "marks": [
                            {
                                "type": "link",
                                "attrs": {
                                    "href": "https://baidu.com"
                                }
                            }
                        ],
                        "text": "链接"
                    }
                ]
            },
            {
                "type": "paragraph"
            },
            {
                "type": "paragraph",
                "content": [
                    {
                        "type": "text",
                        "text": "第三段,富文本段落 "
                    },
                    {
                        "type": "text",
                        "marks": [
                            {
                                "type": "link",
                                "attrs": {
                                    "href": "https://bing.com"
                                }
                            },
                            {
                                "type": "highlight"
                            },
                            {
                                "type": "bold"
                            }
                        ],
                        "text": "加粗并高亮的链接"
                    }
                ]
            },
            {
                "type": "paragraph"
            },
            {
                "type": "quote",
                "content": [
                    {
                        "type": "text",
                        "text": "第四段,引用文本段落"
                    }
                ]
            },
            {
                "type": "paragraph"
            },
            {
                "type": "quote",
                "content": [
                    {
                        "type": "text",
                        "text": "第五段,引用文本段落也可以有富文本 "
                    },
                    {
                        "type": "text",
                        "marks": [
                            {
                                "type": "link",
                                "attrs": {
                                    "href": "https://bing.com"
                                }
                            },
                            {
                                "type": "highlight"
                            },
                            {
                                "type": "bold"
                            }
                        ],
                        "text": "加粗并高亮的链接"
                    }
                ]
            },
            {
                "type": "paragraph"
            },
            {
                "type": "note",
                "attrs": {
                    "uuid": "VPrWsE_-P0qwrFUOygGs8"
                }
            }
        ]
    }
}
image.png
上一页
1. 概述
下一页
3. 错误码
Built with