// 不要自行按 startPage 排序,页码在摘录子笔记上,卡自身没有页码
const tree = await mn.api('/study-sets/' + topicid + '/tree?sort=document');
const cards = tree.nodes;
mn.log(tree.nodeTotal, tree.nextCursor, tree.truncated);
// 翻下一页时把 nextCursor 带返回去
if (tree.nextCursor) {
const more = await mn.api('/study-sets/' + topicid
+ '/tree?sort=document&cursor=' + tree.nextCursor);
}{
"topicid": "77012CA0-48E8-4D29-B5F5-1EEA927AE086",
"bridgeApiVersion": "0.61",
"nodeTotal": 15,
"nodes": [
{
"noteid": "BCC8D945-7585-425A-9FDF-E24C6503F628",
"parent": null,
"depth": 0,
"folded": false,
"hasInk": false,
"title": "一元一次方程与百分数·练习A",
"isReference": 0,
"preview": "一元一次方程与百分数·练习A",
"childCount": 0,
"kind": "framework"
},
{
"noteid": "055E30EF-A59E-44AC-9459-997EEB5481A6",
"parent": null,
"depth": 0,
"folded": false,
"hasInk": false,
"title": "理工公式对照材料",
"isReference": 0,
"preview": "理工公式对照材料",
"childCount": 1,
"kind": "framework"
},
{
"noteid": "8AEDDBF9-BDD8-4D91-AC31-5DEAC8DF1DA1",
"parent": "055E30EF-A59E-44AC-9459-997EEB5481A6",
"depth": 1,
"folded": false,
"hasInk": false,
"title": "(1.2)",
"isReference": 1,
"preview": "(1.2)",
"childCount": 0,
"kind": "card"
}
],
"nextCursor": null
}获取学习集脑图
读整个学习集的脑图结构、标题与逻辑属性。
节点是扁平数组,父子关系靠每一项的 parent 自行组合,没有嵌套的下层数组。
要按文档顺序排列时带 sort=document。不要自行按页码排序:摘录与摘题产出的卡自身没有
页码,页码在该题的摘录子笔记上。带该参数时由 MarginNote 排序,判据与界面上的按页码排序逐字一致,
并给每个节点补上 docPage 与 docBookmd5。排序在切片之前对整条序列做,跨页顺序因此是对的。
翻页用 limit 与 cursor,响应里的 nextCursor 为 null 表示已到末尾。
达到遍历上限时 walkLimitReached 为真,为真时才表示读到末页也取不全。
// 不要自行按 startPage 排序,页码在摘录子笔记上,卡自身没有页码
const tree = await mn.api('/study-sets/' + topicid + '/tree?sort=document');
const cards = tree.nodes;
mn.log(tree.nodeTotal, tree.nextCursor, tree.truncated);
// 翻下一页时把 nextCursor 带返回去
if (tree.nextCursor) {
const more = await mn.api('/study-sets/' + topicid
+ '/tree?sort=document&cursor=' + tree.nextCursor);
}{
"topicid": "77012CA0-48E8-4D29-B5F5-1EEA927AE086",
"bridgeApiVersion": "0.61",
"nodeTotal": 15,
"nodes": [
{
"noteid": "BCC8D945-7585-425A-9FDF-E24C6503F628",
"parent": null,
"depth": 0,
"folded": false,
"hasInk": false,
"title": "一元一次方程与百分数·练习A",
"isReference": 0,
"preview": "一元一次方程与百分数·练习A",
"childCount": 0,
"kind": "framework"
},
{
"noteid": "055E30EF-A59E-44AC-9459-997EEB5481A6",
"parent": null,
"depth": 0,
"folded": false,
"hasInk": false,
"title": "理工公式对照材料",
"isReference": 0,
"preview": "理工公式对照材料",
"childCount": 1,
"kind": "framework"
},
{
"noteid": "8AEDDBF9-BDD8-4D91-AC31-5DEAC8DF1DA1",
"parent": "055E30EF-A59E-44AC-9459-997EEB5481A6",
"depth": 1,
"folded": false,
"hasInk": false,
"title": "(1.2)",
"isReference": 1,
"preview": "(1.2)",
"childCount": 0,
"kind": "card"
}
],
"nextCursor": null
}路径参数
学习集的 topicid。取自 GET /ui-state 的 state.topicid、GET /library/study-sets,或 GET /writing/context 响应里的 window.topicid。
查询参数
指定子脑图根卡的 noteid,只读其中一张。取自 GET /study-sets/{topicid}/sub-maps。
一次返回的节点数上限。
1 <= x <= 5000下一页的起点,取上一页响应里的 nextCursor。
按文档顺序排列。排序在分页切片之前对整条序列做,跨页顺序因此是对的。
document 带 withNotes=1 时,一并返回每个标签下直接存有该条完整路径的卡片 id。
1 响应
脑图。节点是扁平数组,父子关系靠 parent 字段表示。
整个学习集的脑图。节点是扁平数组,父子关系由每项的 parent 写出,没有嵌套的 children。
翻页时带 limit 与 cursor;要按文档顺序排列时带 sort=document,此时顶层多出 sort,
节点上多出 docPage 与 docBookmd5。
整棵树的节点数。翻页之前该数值已经可用。
Show child attributes
Show child attributes
下一页的起点。为 null 表示已到末尾。
撞上了遍历硬顶。只有该字段为 true 才表示即使读到末页也取不全。
该响应不是全部:还有下一页,或撞上了硬顶。
只在带 sort=document 时出现。