setting-up-a-custom-rest-source
它能做什么
这项技能教智能体如何通过编写配置文件,把网络 API 的数据导入 PostHog 数据仓库。适合想获取内部工具或 PostHog 不直接支持的小众服务数据的人。
适用场景
- ✓当你想从一个没有内置 PostHog 连接器的 API 导入数据的时候。
- ✓当你手上有某个 API 的文档链接,并希望把它的数据放进数据仓库的时候。
- ✓当你想把内部服务作为自定义数据源接入 PostHog 的时候。
技能链接
https://github.com/PostHog/posthog/blob/master/products/warehouse_sources/skills/setting-up-a-custom-rest-source/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“这是我们内部 API 的文档链接。你能帮我设置一下,让它的数据显示在 PostHog 的数据仓库中吗?”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会先检查是否已有内置连接器。如果没有,它会编写一个简短的配置文件来描述 API 的端点,然后在创建数据源之前,用实时数据进行测试。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Setting up a Custom REST source
A Custom source imports any HTTP REST API into queryable warehouse tables from a JSON manifest — no
per-source Python. The manifest is a RESTAPIConfig: the same shape that powers PostHog's built-in REST connectors
(Intercom, Attio, Sentry, …), so the generic REST engine handles auth, pagination, JSONPath record extraction, and
incremental cursors for you. Your job is to author a correct manifest and prove it against live data before creating
the source.
This is a beta capability. Caps: at most 50 resources per manifest, and at most 5 Custom sources per project.
When to use this skill
- The user wants to import an API that has no built-in connector — an internal service, a niche SaaS, a public API — and can give you its docs URL or describe its endpoints.
- The user explicitly asks for a "custom REST source", "custom source manifest", or to "build a connector from docs".
A Custom source is the fallback — only correct when no native connector fits. PostHog ships hundreds of native
connectors, far more than could be listed here, so never assume an API has no built-in — most well-known SaaS apps
and databases do, and guessing wrong misroutes them into a hand-authored manifest that duplicates a battle-tested
connector. Step 0 below makes you check the registry before drafting anything; if a native connector matches, hand off
to setting-up-a-data-warehouse-source instead.
The grammar
Read references/manifest-reference.md before drafting — it is the full
RESTAPIConfig field reference (auth types, the six paginators, incremental cursors, parent/child fan-out) with worked
examples for each. Draft the manifest from that grammar; don't guess field names.
The skeleton:
{
"client": {
"base_url": "https://api.example.com/v1",
"auth": { "type": "bearer" }
},
"resources": [
{
"name": "users",
"primary_key": "id",
"endpoint": {
"path": "/users",
"data_selector": "data",
"paginator": { "type": "json_response", "next_url_path": "next" },
"incremental": { "cursor_path": "updated_at", "start_param": "since" }
}
}
]
}
Secrets never go inline in the manifest. manifest_json holds only the non-secret structure. The credential
travels in a separate payload key chosen by the manifest's client.auth.type: auth_token (bearer), auth_api_key
(api_key), auth_password (http_basic), or auth_oauth2_client_secret for oauth2 (plus
auth_oauth2_refresh_token for the refresh-token grant only). The
engine injects it at run time, and PostHog redacts it from every response. Putting a token inline is rejected at
validation.
Available tools
| Tool | Purpose |
|---|---|
external-data-sources-wizard |
List every native source type PostHog supports. Run this first (Step 0) to check whether the target API already has a built-in connector before drafting a manifest. |
external-data-sources-db-schema |
Validate the manifest + credential and list the resources (tables) it exposes, with detected primary keys and incremental cursors. This is the validate-and-list step. |
external-data-sources-preview-resource |
Read a small live sample of rows for one resource — verify data_selector / primary_key / cursor_path against real data before creating anything. |
data-warehouse-source-setup |
Create the source. Enables all manifest resources with sync defaults in one call. |
external-data-sources-create |
Advanced create — lets the user hand-pick which resources sync via a schemas array. |
external-data-schemas-list |
After creation, watch per-table sync status. |
常见问题
知名应用也要用这个吗?
通常不需要。智能体会先检查内置连接器,因为大多数常用工具都已经有了。
有什么限制吗?
有。每个自定义数据源最多可以有 50 个资源,每个项目最多可以有 5 个自定义数据源。该功能目前处于测试阶段。
智能体需要为每个数据源编写代码吗?
不需要。数据源是在 JSON 配置文件中定义的,而不是通过自定义代码。
详情
作者的原始描述
Connect an arbitrary REST API to the PostHog data warehouse as a Custom source by authoring a JSON manifest, with no per-source code. Use when the user points at an API that has no built-in PostHog connector — "import data from this REST API", "sync my internal API", "connect this API from its docs", "build a custom data warehouse source" — and gives a docs URL or a natural-language description of the endpoints. Walks through drafting the RESTAPIConfig manifest (auth — bearer, API key, HTTP basic, or OAuth2 client credentials / refresh token — pagination, record path, incremental cursor, paren
repo: PostHog/posthog
热度
- GitHub 星标
- 41k
- 排名
- #6968
- 许可证
- —
- 更新时间
- 2026/11/2
评论
- …
同一仓库的更多技能
depot-ci
41k帮你的智能体设置并运行 Depot CI 工作流(GitHub Actions 的替代方案),包括迁移现有工作流和读取运行日志。
depot-container-builds
41k帮你的智能体在 Depot 的远程构建器上构建 Docker 镜像,包括多平台镜像、推送到镜像仓库,以及修复构建失败。
depot-github-runners
41k帮你的智能体把 GitHub Actions 任务迁移到 Depot 托管的运行器上,选择运行器规格和标签,并排查运行器设置问题。
editing-agents-md
41k帮你的智能体判断某条规则应写入 AGENTS.md 还是 CLAUDE.md,并以不会让文件臃肿的方式写下,确保规则真正生效。