V2
页面属性模型
区分数据库属性 schema、页面属性值和 property item 分页返回结构。
页面属性模型
适用范围
本页只说明数据库 schema、页面属性值以及 property_item 返回结构之间的关系。属性如何过滤、排序或写入,放到对应接口页说明。
核心定义
| 概念 | 位置 | 作用 |
|---|---|---|
| 数据库属性 schema | database.properties | 描述数据库里某个属性的定义、类型和可选配置。 |
| 页面属性值 | page.properties | 描述页面上某个属性当前存的值。 |
property_item | 属性单独读取时 | 描述某个属性的分页外壳或单值响应。 |
字段说明或规则
数据库 schema 与页面属性值
数据库 schema 和页面属性值不是同一个东西。
- schema 定义“这个属性是什么”,例如标题、选择、日期、关联
- value 定义“这个页面当前填了什么”
- 同一个属性在 schema 和 value 中会共享
type,但承载的内容不同
数据库返回的 properties 里,每个条目通常包含 id、name、type 以及类型相关配置;页面返回的 properties 里,每个条目通常包含 id、type 和对应的值字段。
页面属性值类型
页面属性值常见的类型字段包括:
titlerich_textnumberselectmulti_selectdatepeoplefilescheckboxurlemailphone_numberformularelationrollupcreated_timecreated_bylast_edited_timelast_edited_by
property_item 的分页结构
当属性内容较大,或者属性本身就是多值集合时,接口会返回分页结构。
{
"object": "list",
"type": "property_item",
"property_item": {
"object": "property_item",
"id": "title",
"type": "title"
},
"results": [],
"has_more": false,
"next_cursor": null
}
object固定为"list"type固定为"property_item"property_item是当前属性的元信息results是这一页的属性值片段has_more和next_cursor服从统一游标分页约定
单值 property_item
对于选择、数字、布尔、日期等单值属性,接口可能直接返回单个 property_item 对象,而不是分页列表。
{
"object": "property_item",
"id": "status",
"type": "select",
"select": {
"id": "doing",
"name": "进行中",
"color": "yellow"
}
}
常见注意事项
- 不要把数据库
properties当成页面properties,前者是 schema,后者是值。 property_id通常是属性 ID,不是展示名。- 属性分页返回的
results只是当前页片段,不代表属性的完整内容已经一次返回完。
