使用 API 演练场#
¥Using an API playground
此文档站点提供了一个测试调用的实验环境。自托管用户还可以访问其实例中内置的 Playground。
¥This documentation site provides a playground to test out calls. Self-hosted users also have access to a built-in playground hosted as part of their instance.
文档测试环境#
¥Documentation playground
你可以从本网站的 API 参考 测试 API 调用。你需要设置服务器的基本 URL 和实例名称,并添加 API 密钥。
¥You can test API calls from this site's API reference. You need to set your server's base URL and instance name, and add an API key.
n8n 使用 Scalar 的 开源 API 平台来支持此功能。
¥n8n uses Scalar's open source API platform to power this functionality.
Exposed API key and data
使用 Playground 时,请使用具有有限范围和测试数据的测试 API 密钥。所有来自 playground 的调用均通过 Scalar 的代理服务器路由。
¥Use a test API key with limited scopes and test data when using a playground. All calls from the playground are routed through Scalar's proxy servers.
Real data
你可以访问你的实时数据。这对于测试请求非常有用。请注意,你可能会更改或删除真实数据。
¥You have access to your live data. This is useful for trying out requests. Be aware you can change or delete real data.
内置 Playground#
¥Built-in playground
Feature availability
API Playground 在云端不可用。它适用于所有自托管定价层级。
¥The API playground isn't available on Cloud. It's available for all self-hosted pricing tiers.
n8n API 在自托管版本中内置了 Swagger UI Playground。这提供了交互式文档,你可以在其中尝试请求。访问 Playground 的路径取决于你的主机配置。
¥The n8n API comes with a built-in Swagger UI playground in self-hosted versions. This provides interactive documentation, where you can try out requests. The path to access the playground depends on your hosting.
n8n 根据你设置的环境变量值构建路径:
¥n8n constructs the path from values set in your environment variables:
1 | |
API 版本号为 1。未来可能会有多个版本。
¥The API version number is 1. There may be multiple versions available in the future.
Real data
如果你选择“授权”并在 API Playground 中输入你的 API 密钥,即可访问你的实时数据。这对于测试请求非常有用。请注意,你可能会更改或删除真实数据。
¥If you select Authorize and enter your API key in the API playground, you have access to your live data. This is useful for trying out requests. Be aware you can change or delete real data.
API 包含有关凭据格式的内置文档。此功能可通过 credentials 端点使用:
¥The API includes built-in documentation about credential formats. This is available using the credentials endpoint:
1 | |
How to find credentialTypeName
要查找类型,请将你的工作流下载为 JSON 并进行检查。例如,对于 Google 云端硬盘节点,{credentialTypeName} 应为 googleDriveOAuth2Api:
¥To find the type, download your workflow as JSON and examine it. For example, for a Google Drive node the {credentialTypeName} is googleDriveOAuth2Api:
1 2 3 4 5 6 7 8 9 | |