创建页面
POST/wiki/pages
创建页面。不同页面类型的支持情况:
页面类型 | content | cards | attachments | resources | attachmentOrResourceFileUUID |
---|---|---|---|---|---|
collaboration | 支持。内容为协同页面 json | 支持 | 支持 | 支持 | 支持 |
History
Version | Changes |
---|---|
v6.12.0 | Added in: v6.12.0 |
创建页面。不同页面类型的支持情况:
页面类型 | content | cards | attachments | resources | attachmentOrResourceFileUUID |
---|---|---|---|---|---|
collaboration | 支持。内容为协同页面 json(参考:文档数据结构) | 支持 | 支持 | 支持 | 支持 |
curl 示例:
curl --location --request POST 'https://your-domain/openapi/v2/wiki/pages?teamID=<teamID>' \
--header 'Authorization: Bearer <TOKEN>' \
--form 'parentPageID="<ParentPageID>"' \
--form 'title="open api from form-data"' \
--form 'attachments="[\"attachmentRandomId\"]"' \
--form 'attachmentRandomId=@"your-attachment-file"' \
--form 'resources="[\"resourceRandomId\"]"' \
--form 'resourceRandomId=@"your-resource-file"' \
--form 'cards="[{\"type\": \"attachment\", \"config\": [\"attachmentRandomId\"], \"id\": \"cardRandomId\"}]"' \
--form 'content="{
\"blocks\": [
{
\"id\": \"fkpFQHTFP\",
\"type\": \"text\",
\"text\": [
{
\"insert\": \"open api from form-data\"
}
],
\"heading\": 1,
\"quoted\": false
},
{
\"id\": \"zrzebX_5P\",
\"type\": \"text\",
\"text\": [
{
\"insert\": \"资源\"
}
],
\"heading\": 2
},
{
\"id\": \"bBb4SGK_9\",
\"type\": \"text\",
\"text\": [
{
\"insert\": \"embedData 里面的 src 是资源随机 ID。上传文件的 key 和此 ID 相同,value 是具体的资源文件。\"
}
]
},
{
\"id\": \"Nckftr1QB\",
\"type\": \"embed\",
\"embedType\": \"image\",
\"align\": \"left\",
\"embedData\": {
\"src\": \"resourceRandomId\",
\"widthPercent\": 41.83070866141732,
\"8c8d4fa06483a35dffa314ec88fad792_width\": 425,
\"8c8d4fa06483a35dffa314ec88fad792_height\": 307,
\"0_flex\": 1
}
},
{
\"id\": \"hYtCamqSj\",
\"type\": \"text\",
\"text\": [
{
\"insert\": \"附件卡片\"
}
],
\"heading\": 2
},
{
\"id\": \"DWkP4GVAF\",
\"type\": \"text\",
\"text\": [
{
\"insert\": \"embedData 里面的 cardUuid 是卡片随机 ID。cards 列表中的 ID 和此 ID 相同。卡片包含哪些卡片,也是由 cards 列表中的 attachments 决定。attachments 列表中的 ID 是附件随机 ID。上传文件中的 key 和此 ID 相同,value 是具体的附件文件。\"
}
]
},
{
\"id\": \"fadFDWnZY\",
\"type\": \"embed\",
\"embedType\": \"file-list\",
\"embedData\": {
\"cardUuid\": \"cardRandomId\"
}
},
{
\"id\": \"PNWe0PcC7\",
\"type\": \"text\",
\"text\": []
}
]
}"'
Request
- multipart/form-data
Body
required
Array [
- MOD1
]
parentPageID string
父页面 ID
title string
页面名称
content string
页面内容
cards
object[]
卡片列表
type string
Possible values: [attachments
]
卡片类型
id uuid
卡片 ID
config
object
卡片配置
oneOf
attachments uuid[]
附件卡片配置,是附件 ID 数组
attachments uuid[]
附件 ID 列表
resources uuid[]
资源 ID 列表,资源是页面中的图片、视频、音频等多媒体资源
attachmentOrResourceFileUUID binary
key 不是固定值。是资源或者附件的 ID,value 是文件。
Responses
- 200
- 401
- 403
- 404
- 500
成功
- application/json
- Schema
- Example (from schema)
Schema
id string
页面 ID
title string
页面名称
spaceID string
页面组 ID
createdTime integer
创建时间
updatedTime integer
更新时间
parentID string
父页面 ID
refType string
引用类型
refID string
引用 ID
subRefType string
子引用类型
isArchived boolean
是否归档
encryptStatus string
加密状态,none: 未加密,encrypted: 已加密,readonly: 只读
canEdit boolean
是否可编辑
locked boolean
是否锁定
{
"id": "string",
"title": "string",
"spaceID": "string",
"createdTime": 0,
"updatedTime": 0,
"parentID": "string",
"refType": "string",
"refID": "string",
"subRefType": "string",
"isArchived": true,
"encryptStatus": "string",
"canEdit": true,
"locked": true
}
如果身份验证凭据不正确或丢失,则返回
- application/json
- Schema
- Example (from schema)
Schema
result string
本次请求结果,SUCCESS|FAIL
errorCode string
本次请求错误码
errorMsg string
本次请求错误信息
{
"result": "FAIL",
"errorCode": "Unauthorized",
"errorMsg": "Access token is invalid"
}
如果scope检验不通过,则返回
- application/json
- Schema
- Example (from schema)
Schema
result string
本次请求结果,SUCCESS|FAIL
errorCode string
本次请求错误码
errorMsg string
本次请求错误信息
{
"result": "FAIL",
"errorCode": "Forbidden",
"errorMsg": "Scope is invalid"
}
如果未找到资源对象,则返回
- application/json
- Schema
- Example (from schema)
Schema
result string
本次请求结果,SUCCESS|FAIL
errorCode string
本次请求错误码
errorMsg string
本次请求错误信息
{
"result": "FAIL",
"errorCode": "NotFound",
"errorMsg": "Not Found"
}
内部服务器错误
- application/json
- Schema
- Example (from schema)
Schema
result string
本次请求结果,SUCCESS|FAIL
errorCode string
本次请求错误码
errorMsg string
本次请求错误信息
{
"result": "FAIL",
"errorCode": "Internal Server Error",
"errorMsg": "Internal Server Error"
}
Loading...