创建文档
POST {{base_url}}/doc/v2/create
Reference
- 参考接口 创建文档
Success Response Sample
{
"code": 0,
"data": {
"objToken": "doccn4mWccrq3yrJoLdMYzqKQke",
"url": "https://test-c8uqj3hi5a9b.feishu.cn/docs/doccn4mWccrq3yrJoLdMYzqKQke"
},
"msg": "Success"
}
Request Body
{"FolderToken"=>"", "Content"=>"{\"title\":{\"elements\":[{\"type\":\"textRun\",\"textRun\":{\"text\":\"Hello Docs\",\"style\":{}}}]},\"body\":{\"blocks\":[{\"type\":\"paragraph\",\"paragraph\":{\"elements\":[{\"type\":\"textRun\",\"textRun\":{\"text\":\"恭喜你成功通过 Open API 创建了一篇在线文档。这篇文档中,描述了大部分 Open API 已经支持的文档内容,你可以对照示例代码,了解 Docs Open API 的使用方法。\",\"style\":{}}}]}},{\"type\":\"paragraph\",\"paragraph\":{\"elements\":[],\"style\":{}}},{\"type\":\"paragraph\",\"paragraph\":{\"elements\":[{\"type\":\"textRun\",\"textRun\":{\"text\":\"你可以通过文档的 URL,截取获得文档的 token,文档所有的 API 操作,都需要提供 token,例如:\",\"style\":{}}}]}},{\"type\":\"code\",\"code\":{\"language\":\"Plain Text\",\"body\":{\"blocks\":[{\"type\":\"paragraph\",\"paragraph\":{\"elements\":[{\"type\":\"textRun\",\"textRun\":{\"text\":\"https://xxx.feishu.cn/docs/\",\"style\":{}}},{\"type\":\"textRun\",\"textRun\":{\"text\":\"doccnmPiiJWfj1uk8bV7N5SzXaa\",\"style\":{\"backColor\":{\"red\":255,\"green\":246,\"blue\":122,\"alpha\":0.8}}}}],\"style\":{}}}]}}},{\"type\":\"paragraph\",\"paragraph\":{\"elements\":[],\"style\":{}}},{\"type\":\"paragraph\",\"paragraph\":{\"elements\":[{\"type\":\"textRun\",\"textRun\":{\"text\":\"从上面的例子中,可以看出:文档中的每一行都是一个 Block\",\"style\":{}}}],\"style\":{\"headingLevel\":1}}},{\"type\":\"paragraph\",\"paragraph\":{\"elements\":[{\"type\":\"textRun\",\"textRun\":{\"text\":\"文档中有多种 Block 类型,在插入内容时,你需要指定当前行是什么类型的 Block,文本类型的 Block 叫做 Paragraph。\",\"style\":{}}}],\"style\":{}}},{\"type\":\"paragraph\",\"paragraph\":{\"elements\":[{\"type\":\"textRun\",\"textRun\":{\"text\":\"一行文本可能由多个元素组成,例如这一行,就由公式 \",\"style\":{}}},{\"type\":\"equation\",\"equation\":{\"equation\":\"E=mc^2\"}},{\"type\":\"textRun\",\"textRun\":{\"text\":\" 和 \",\"style\":{}}},{\"type\":\"textRun\",\"textRun\":{\"text\":\"行内代码块\",\"style\":{\"codeInline\":true}}},{\"type\":\"textRun\",\"textRun\":{\"text\":\" 组成。如果一些文本包含\",\"style\":{}}},{\"type\":\"textRun\",\"textRun\":{\"text\":\"独立的样式\",\"style\":{\"backColor\":{\"red\":255,\"green\":246,\"blue\":122,\"alpha\":0.8}}}},{\"type\":\"textRun\",\"textRun\":{\"text\":\",也会被视为一个独立的 element。\",\"style\":{}}}],\"style\":{}}},{\"type\":\"paragraph\",\"paragraph\":{\"elements\":[],\"style\":{}}},{\"type\":\"paragraph\",\"paragraph\":{\"elements\":[{\"type\":\"textRun\",\"textRun\":{\"text\":\"你可以通过 API 插入各种样式的内容\",\"style\":{}}}],\"style\":{\"headingLevel\":1}}},{\"type\":\"paragraph\",\"paragraph\":{\"elements\":[{\"type\":\"textRun\",\"textRun\":{\"text\":\"支持插入有序列表\",\"style\":{}}}],\"style\":{\"list\":{\"type\":\"number\",\"indentLevel\":1,\"number\":1}}}},{\"type\":\"paragraph\",\"paragraph\":{\"elements\":[{\"type\":\"textRun\",\"textRun\":{\"text\":\"你可以自己指定有序列表的编号\",\"style\":{}}}],\"style\":{\"list\":{\"type\":\"number\",\"indentLevel\":1,\"number\":2}}}},{\"type\":\"paragraph\",\"paragraph\":{\"elements\":[{\"type\":\"textRun\",\"textRun\":{\"text\":\"也可以插入无序列表\",\"style\":{}}}],\"style\":{\"list\":{\"type\":\"bullet\",\"indentLevel\":1}}}},{\"type\":\"paragraph\",\"paragraph\":{\"elements\":[{\"type\":\"textRun\",\"textRun\":{\"text\":\"插入更多无序列表\",\"style\":{}}}],\"style\":{\"list\":{\"type\":\"bullet\",\"indentLevel\":1}}}},{\"type\":\"paragraph\",\"paragraph\":{\"elements\":[{\"type\":\"textRun\",\"textRun\":{\"text\":\"支持插入任务列表和日期提醒 \",\"style\":{}}},{\"type\":\"reminder\",\"reminder\":{\"isWholeDay\":false,\"timestamp\":1609497000,\"shouldNotify\":true}}],\"style\":{\"list\":{\"type\":\"checkBox\",\"indentLevel\":1},\"todoUUID\":\"126f1471-f013-4ed1-9820-60f24da80677\"}}},{\"type\":\"paragraph\",\"paragraph\":{\"elements\":[{\"type\":\"textRun\",\"textRun\":{\"text\":\"或者插入引用的内容\",\"style\":{}}}],\"style\":{\"quote\":true}}},{\"type\":\"paragraph\",\"paragraph\":{\"elements\":[{\"type\":\"textRun\",\"textRun\":{\"text\":\"改变文档的对齐方式,例如\",\"style\":{}}},{\"type\":\"textRun\",\"textRun\":{\"text\":\"右对齐\",\"style\":{}}}],\"style\":{\"align\":\"right\"}}},{\"type\":\"paragraph\",\"paragraph\":{\"elements\":[{\"type\":\"textRun\",\"textRun\":{\"text\":\"此外,还能灵活应用各种文字样式,增强文档的表达能力,例如:\",\"style\":{}}}],\"style\":{\"align\":\"left\"}}},{\"type\":\"paragraph\",\"paragraph\":{\"elements\":[{\"type\":\"textRun\",\"textRun\":{\"text\":\"加粗 \",\"style\":{\"bold\":true}}},{\"type\":\"textRun\",\"textRun\":{\"text\":\"斜体 \",\"style\":{\"italic\":true}}},{\"type\":\"textRun\",\"textRun\":{\"text\":\"下划线 \",\"style\":{\"underLine\":true}}},{\"type\":\"textRun\",\"textRun\":{\"text\":\"删除线\",\"style\":{\"strikeThrough\":true}}},{\"type\":\"textRun\",\"textRun\":{\"text\":\" \",\"style\":{}}},{\"type\":\"textRun\",\"textRun\":{\"text\":\"inline code\",\"style\":{\"codeInline\":true}}},{\"type\":\"textRun\",\"textRun\":{\"text\":\" \",\"style\":{}}},{\"type\":\"textRun\",\"textRun\":{\"text\":\"高亮\",\"style\":{\"backColor\":{\"red\":255,\"green\":246,\"blue\":122,\"alpha\":0.8}}}},{\"type\":\"textRun\",\"textRun\":{\"text\":\"色\",\"style\":{\"backColor\":{\"red\":255,\"green\":246,\"blue\":122,\"alpha\":0.8}}}},{\"type\":\"textRun\",\"textRun\":{\"text\":\" \",\"style\":{}}},{\"type\":\"textRun\",\"textRun\":{\"text\":\"超链接\",\"style\":{\"link\":{\"url\":\"https%3A%2F%2F{{baseUrl}}%2Fdocument%2FukTMukTMukTM%2FukjM5YjL5ITO24SOykjN\"}}}}]}},{\"type\":\"paragraph\",\"paragraph\":{\"elements\":[{\"type\":\"textRun\",\"textRun\":{\"text\":\"或者一条删除线\",\"style\":{}}}],\"style\":{\"align\":\"center\"}}},{\"type\":\"horizontalLine\",\"horizontalLine\":{}},{\"type\":\"paragraph\",\"paragraph\":{\"elements\":[],\"style\":{}}},{\"type\":\"paragraph\",\"paragraph\":{\"elements\":[{\"type\":\"textRun\",\"textRun\":{\"text\":\"各种表格也支持通过 API 插入,例如\",\"style\":{}}}],\"style\":{\"headingLevel\":1}}},{\"type\":\"paragraph\",\"paragraph\":{\"elements\":[{\"type\":\"textRun\",\"textRun\":{\"text\":\"普通表格\",\"style\":{}}}],\"style\":{\"headingLevel\":2}}},{\"type\":\"table\",\"table\":{\"rowSize\":3,\"columnSize\":3,\"tableRows\":[{\"rowIndex\":0,\"tableCells\":[{\"columnIndex\":0,\"body\":{\"blocks\":[{\"type\":\"paragraph\",\"paragraph\":{\"elements\":[{\"type\":\"textRun\",\"textRun\":{\"text\":\"你可以通过表格进行排版\",\"style\":{}}}],\"style\":{\"align\":\"center\"}}},{\"type\":\"paragraph\",\"paragraph\":{\"elements\":[{\"type\":\"textRun\",\"textRun\":{\"text\":\"表格中的每一行也是一个 Block\",\"style\":{}}}],\"style\":{\"align\":\"center\"}}},{\"type\":\"paragraph\",\"paragraph\":{\"elements\":[{\"type\":\"textRun\",\"textRun\":{\"text\":\"此外,每个单元格都通过唯一的 zoneId 进行标记\",\"style\":{}}}],\"style\":{\"align\":\"center\"}}}]}},{\"columnIndex\":1,\"body\":{\"blocks\":null}},{\"columnIndex\":2,\"body\":{\"blocks\":null}}]},{\"rowIndex\":1,\"tableCells\":[{\"columnIndex\":0,\"body\":{\"blocks\":[{\"type\":\"paragraph\",\"paragraph\":{\"elements\":[{\"type\":\"textRun\",\"textRun\":{\"text\":\"在\",\"style\":{\"codeInline\":true}}}],\"style\":{\"align\":\"center\"}}}]}},{\"columnIndex\":1,\"body\":{\"blocks\":[{\"type\":\"paragraph\",\"paragraph\":{\"elements\":[{\"type\":\"textRun\",\"textRun\":{\"text\":\"飞\",\"style\":{\"codeInline\":true}}}],\"style\":{\"align\":\"center\"}}}]}},{\"columnIndex\":2,\"body\":{\"blocks\":[{\"type\":\"paragraph\",\"paragraph\":{\"elements\":[{\"type\":\"textRun\",\"textRun\":{\"text\":\"书\",\"style\":{\"codeInline\":true}}}],\"style\":{\"align\":\"center\"}}}]}}]},{\"rowIndex\":2,\"tableCells\":[{\"columnIndex\":0,\"body\":{\"blocks\":[{\"type\":\"paragraph\",\"paragraph\":{\"elements\":[{\"type\":\"textRun\",\"textRun\":{\"text\":\"享\",\"style\":{\"codeInline\":true}}}],\"style\":{\"align\":\"center\"}}}]}},{\"columnIndex\":1,\"body\":{\"blocks\":[{\"type\":\"paragraph\",\"paragraph\":{\"elements\":[{\"type\":\"textRun\",\"textRun\":{\"text\":\"高\",\"style\":{\"codeInline\":true}}}],\"style\":{\"align\":\"center\"}}}]}},{\"columnIndex\":2,\"body\":{\"blocks\":[{\"type\":\"paragraph\",\"paragraph\":{\"elements\":[{\"type\":\"textRun\",\"textRun\":{\"text\":\"效\",\"style\":{\"codeInline\":true}}}],\"style\":{\"align\":\"center\"}}}]}}]}],\"tableStyle\":{\"tableColumnProperties\":[{\"width\":100},{\"width\":100},{\"width\":100}]},\"mergedCells\":[{\"mergedCellId\":\"p47dtbcp\",\"rowStartIndex\":0,\"columnStartIndex\":0,\"rowEndIndex\":1,\"columnEndIndex\":3}]}},{\"type\":\"paragraph\",\"paragraph\":{\"elements\":[{\"type\":\"textRun\",\"textRun\":{\"text\":\"数据表\",\"style\":{}}}],\"style\":{\"headingLevel\":2}}},{\"type\":\"bitable\",\"bitable\":{\"viewType\":\"grid\"}},{\"type\":\"paragraph\",\"paragraph\":{\"elements\":[{\"type\":\"textRun\",\"textRun\":{\"text\":\"看板\",\"style\":{}}}],\"style\":{\"headingLevel\":2}}},{\"type\":\"bitable\",\"bitable\":{\"viewType\":\"kanban\"}},{\"type\":\"paragraph\",\"paragraph\":{\"elements\":[]}},{\"type\":\"paragraph\",\"paragraph\":{\"elements\":[{\"type\":\"textRun\",\"textRun\":{\"text\":\"电子表格\",\"style\":{}}}],\"style\":{\"headingLevel\":2}}},{\"type\":\"sheet\",\"sheet\":{\"rowSize\":3,\"columnSize\":4}},{\"type\":\"paragraph\",\"paragraph\":{\"elements\":[],\"style\":{}}},{\"type\":\"paragraph\",\"paragraph\":{\"elements\":[{\"type\":\"textRun\",\"textRun\":{\"text\":\"我是网页\",\"style\":{}}}],\"style\":{\"headingLevel\":2}}},{\"type\":\"embeddedPage\",\"embeddedPage\":{\"type\":\"xigua\",\"url\":\"https%3A%2F%2Fwww.ixigua.com%2Fiframe%2F6763174234282787341%3Fautoplay%3D0\",\"width\":637,\"height\":358}},{\"type\":\"paragraph\",\"paragraph\":{\"elements\":[]}}]}}"}
HEADERS
Key | Datatype | Required | Description |
---|---|---|---|
Authorization | string | user_access_token 或 tenant_access_token | |
值格式:"Bearer access_token" |
示例值:"Bearer u-7f1bcd13fc57d46bac21793a18e560" |
| Content-Type
| string | | 固定值:"application/json; charset=utf-8" |
RESPONSES
status: OK
{"code":0,"data":{"objToken":"doccniBTXMe1hEJMOfTQT03PHKc","url":"https://bytedance.feishu.cn/docs/doccniBTXMe1hEJMOfTQT03PHKc"},"msg":"Success"}