返回顶部
n

notion-openapi-skillNotion开放接口

Operate Notion Public API through UXC with a curated OpenAPI schema for search, block traversal, page reads, content writes, and data source/database inspection. Use when tasks need recursive reads or structured writes that Notion MCP does not expose directly.

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.0.0
安全检测
已通过
84
下载量
免费
免费
0
收藏
概述
安装方式
版本历史

notion-openapi-skill

Notion 公共 API 技能

使用此技能通过 uxc + OpenAPI 运行 Notion 公共 API 操作。

复用 uxc 技能以获取共享执行、OAuth 和错误处理指导。

前提条件

  • - uxc 已安装并可在 PATH 中使用。
  • 可访问 https://api.notion.com/v1 的网络。
  • 可访问精选的 OpenAPI 模式 URL:
- https://raw.githubusercontent.com/holon-run/uxc/main/skills/notion-openapi-skill/references/notion-public.openapi.json
  • - 具有内容读取权限的 Notion 集成令牌或 OAuth 凭证。
  • 对于写入操作,集成还需要相应的 Notion 插入/更新内容能力。

范围

此技能涵盖以读取优先的 Notion REST 接口,专注于遍历及常见内容写入:

  • - 令牌身份验证
  • 页面、数据源和数据库的标题搜索
  • 页面查找
  • 块查找
  • 通过块子级分页进行递归遍历
  • 页面属性检索
  • 页面创建
  • 页面更新,包括通过 in_trash 进行删除/恢复
  • 块追加
  • 块更新
  • 块删除
  • 数据源检索和查询
  • 旧版数据库检索和查询

此技能涵盖:

  • - 完整的 Notion REST 覆盖
  • 评论、文件上传、Webhook、页面移动或模式变更
  • 在单个命令内自动递归遍历循环

端点和版本

  • - 基础 URL:https://api.notion.com/v1
  • 此技能所需的版本头:Notion-Version: 2026-03-11

该模式特意围绕遍历和模式发现进行精选。它不是 Notion API 的完整转储。

身份验证

Notion 公共 API 需要:

  • - Authorization: Bearer
  • Notion-Version: 2026-03-11

推荐:专用 REST 凭证

如果您已有内部集成令牌:

bash
uxc auth credential set notion-openapi \
--auth-type api_key \
--header Authorization=Bearer {{secret}} \
--header Notion-Version=2026-03-11 \
--secret-env NOTIONAPITOKEN

uxc auth binding add \
--id notion-openapi \
--host api.notion.com \
--path-prefix /v1 \
--scheme https \
--credential notion-openapi \
--priority 100

如何获取内部集成令牌:

  1. 1. 打开 Notion 集成仪表板,为您的空间创建一个内部集成。
  2. 在集成配置页面中,复制 Notion 显示的 API 密钥。
  3. 在 Notion UI 中,打开每个目标页面、数据源或数据库,通过 共享 或 连接 添加此集成。
  4. 将该 API 密钥用作 NOTIONAPITOKEN 或直接传递给 uxc auth credential set。

如果未将集成连接到目标内容,REST 调用可能成功进行身份验证,但仍会因访问错误而失败,或返回不完整的搜索结果。

如果您希望为 REST 主机使用 OAuth 管理的令牌:

bash
uxc auth oauth start notion-openapi \
--endpoint https://api.notion.com/v1 \
--redirect-uri http://127.0.0.1:8788/callback \
--client-id \
--scope read

uxc auth oauth complete notion-openapi \
--session-id \
--authorization-response http://127.0.0.1:8788/callback?code=...

uxc auth credential set notion-openapi \
--auth-type oauth \
--header Authorization=Bearer {{secret}} \
--header Notion-Version=2026-03-11

uxc auth binding add \
--id notion-openapi \
--host api.notion.com \
--path-prefix /v1 \
--scheme https \
--credential notion-openapi \
--priority 100

高级:复用与 notion-mcp 相同的 OAuth 凭证

如果现有凭证已具有有效的 Notion OAuth 访问令牌,这在技术上可以在 uxc 中实现。

重要提示:

  • - 一旦 OAuth 凭证使用自定义头,请显式包含 Authorization=Bearer {{secret}}
  • 在共享凭证上添加 Notion-Version=2026-03-11 意味着相同的头也将发送到 mcp.notion.com/mcp
  • 预计该额外头是无害的,但这是一种互操作性假设,而非 Notion 的明确保证

共享凭证设置:

bash
uxc auth credential set notion-mcp \
--auth-type oauth \
--header Authorization=Bearer {{secret}} \
--header Notion-Version=2026-03-11

uxc auth binding add \
--id notion-openapi-shared \
--host api.notion.com \
--path-prefix /v1 \
--scheme https \
--credential notion-mcp \
--priority 100

当身份验证看起来有问题时,验证有效的映射:

bash
uxc auth binding match https://api.notion.com/v1

核心工作流程

  1. 1. 默认使用固定链接命令:
- command -v notion-openapi-cli - 如果缺失,创建它: uxc link notion-openapi-cli https://api.notion.com/v1 --schema-url https://raw.githubusercontent.com/holon-run/uxc/main/skills/notion-openapi-skill/references/notion-public.openapi.json - notion-openapi-cli -h
  1. 2. 首先检查操作模式:
- notion-openapi-cli post:/search -h - notion-openapi-cli get:/blocks/{block_id}/children -h - notion-openapi-cli post:/pages -h - notion-openapi-cli patch:/blocks/{block_id}/children -h - notion-openapi-cli post:/datasources/{datasource_id}/query -h
  1. 3. 在进行更广泛的遍历之前,优先进行读取验证:
- notion-openapi-cli get:/users/me - notion-openapi-cli post:/search {query:Roadmap,filter:{property:object,value:page},page_size:10} - notion-openapi-cli get:/blocks/{blockid}/children blockid= page_size=100
  1. 4. 在 API 调用边界之外递归遍历:
- 使用 get:/blocks/{block_id}/children 逐页进行 - 对于每个返回的 haschildren=true 的子块,再次对该子 ID 调用 get:/blocks/{blockid}/children
  1. 5. 在属性敏感查询之前,使用数据源或旧版数据库读取来发现模式:
- notion-openapi-cli get:/datasources/{datasourceid} datasource_id= - notion-openapi-cli post:/datasources/{datasourceid}/query datasourceid= {pagesize:25} - notion-openapi-cli get:/databases/{databaseid} databaseid=
  1. 6. 仅在获得用户明确确认后执行写入操作:
- 创建页面:notion-openapi-cli post:/pages {...} - 追加块:notion-openapi-cli patch:/blocks/{block_id}/children {...} - 更新页面或块:notion-openapi-cli patch:/pages/{page_id} {...} - 删除块:notion-openapi-cli delete:/blocks/{blockid} blockid=

操作组

会话/发现

  • - get:/users/me
  • post:/search

页面和块遍历

  • - get:/pages/{pageid}
  • get:/pages/{pageid}/properties/{propertyid}
  • get:/blocks/{blockid}
  • get:/blocks/{block_id}/children

页面和块写入

  • - post:/pages
  • patch:/pages/{pageid}
  • patch:/blocks/{blockid}/children
  • patch:/blocks/{blockid}
  • delete:/blocks/{blockid}

数据源读取

  • - get:/datasources/{datasourceid}
  • post:/datasources/{datasourceid}/query

旧版数据库读取

  • - get:/databases/{databaseid}
  • post:/databases/{databaseid}/query

防护措施

  • - 保持自动化在 JSON 输出信封上;不要使用 --text。
  • 首先解析稳定字段:ok、kind、protocol、data、error。
  • 此技能在凭证/头层

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 notion-openapi-skill-1776060662 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 notion-openapi-skill-1776060662 技能

通过命令行安装

skillhub install notion-openapi-skill-1776060662

下载

⬇ 下载 notion-openapi-skill v1.0.0(免费)

文件大小: 9.23 KB | 发布时间: 2026-4-14 14:32

v1.0.0 最新 2026-4-14 14:32
Initial release of notion-openapi-skill, enabling Notion Public API access via UXC and a curated OpenAPI schema.

- Provides commands for search, block traversal, page reads, and structured content writes in Notion.
- Focuses on recursive reads and operations not covered by the Notion MCP.
- Includes support for token validation, database/data source introspection, and standard CRUD for pages and blocks.
- Requires uxc installed, a Notion integration token or OAuth, and uses a fixed Notion-Version header (2026-03-11).
- Operations grouped into session, traversal, write, and data source/database reads.
- Emphasizes explicit credentials setup and careful validation before write operations.

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部