--- title: "测试 Tulip API" slug: "testing-tulip-apis" updated: 2026-10-22T14:31:44Z published: 2026-10-22T14:31:44Z canonical: "support.tulip.co/testing-tulip-apis" --- > ## Documentation Index > Fetch the complete documentation index at: https://support.tulip.co/llms.txt > Use this file to discover all available pages before exploring further. # 测试 Tulip API Advanced Content This article assumes previous experience with APIs. 请参阅[《表格》](https://support.tulip.co/r230/docs/an-overview-of-tables)、[《操作员](https://support.tulip.co/r230/docs/using-the-user-api)》和《[机器](https://support.tulip.co/docs/how-to-use-the-machine-attributes-api)》相关文章,了解如何设置 API 密钥。 ### 使用 Tulip 连接器测试 Tulip 的 API Feature rename Prior to r383, Service Accounts were called "API Tokens". 请阅读[如何配置连接器](https://support.tulip.co/docs/how-to-configure-a-connector),并使用您已配置的 API 服务账户设置连接器(有关如何配置服务账户,请参阅[这篇文章](https://support.tulip.co/docs/setting-up-the-table-api-for-the-library))。 设置好连接器后,点击“创建函数”。在本示例中,我们将演示如何从表中获取记录。 首先,您需要使用 GET、POST、PUT、HEAD、PATCH 或 DELETE 方法构建请求,然后指定要发送请求的具体 URL([点击此处了解有关我们 API 功能的更多信息)](https://tulip.co/developer/tulip-api-docs/) 。 ![Screenshot 2024-02-28 at 2.35.15 PM.png](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/Screenshot%202024-02-28%20at%202.35.15%20PM.png) NOTE If you are using a global Service Account, you need to specify the workspace. If your Service Account is workspaced scoped, it is optional. *https://(yourinstancenamehere).tulip.co/api/v3/w/(workspace)/tables/(TableID)/records* 请确保添加身份验证信息(来自服务账户本身)、请求头(如有需要)以及查询参数(可在 URL 中直接指定,也可通过查询参数设置——请阅读[如何设置查询参数以获取更多信息](https://support.tulip.co/docs/how-to-set-query-parameters))。 此外,您可以指定连接器函数可能需要反馈给应用程序或自动化流程的任何输入或输出。 ![image.png](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/image%28463%29.png) ### 使用 Postman 测试 Tulip 的 API 下文将介绍如何创建一个操作符。在此示例中,我们将使用[Postman](https://www.postman.com/)进行创建。 首先,将您的 API 端点添加到 POST 请求中。 ![](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/Using%20the%20Operator%20API_222496924.png) 然后,在“授权”部分,选择“基本认证”,并将 API 密钥作为用户名,API 密钥作为密码填写进去。 ![](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/Using%20the%20Operator%20API_222497720.png) 在“标头”下,添加“Auth”标头。 ![](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/Using%20the%20Operator%20API_222497957.png) 在“请求正文”中,将请求格式设置为包含 JSON 对象。此请求的通用格式如下: `{"role": "operator","name": "string","badge_id": "string"}` 效果将类似如下: ![](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/Using%20the%20Operator%20API_222499033.png) 点击“发送”执行请求,您将收到 201 响应,表示操作成功。要验证结果,您可以在“设置”中查看“用户”列表,确认该用户已成功创建。 ![](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/Using%20the%20Operator%20API_222499593.png) 如果请求失败,请务必检查密钥和密钥密文是否正确。有关具体响应代码的更多信息,请查阅 Tulip API 页面上的“API 文档”部分。 ### 使用 API 文档测试 Tulip 的 API 在您的工作区或账户设置中,导航至“Tulip API”。随后,点击“创建服务账户”选项旁边的“了解更多”。 ![image.png](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/image%28462%29.png) 这将带您进入一个页面,您可以在该页面上使用生成的密钥测试 API。该页面还提供了文档,并给出了各种用途的请求正文示例。 该页面还包含配置外部系统进行 API 请求所需的服务器 URL。若要熟悉该 API,请点击“授权”按钮。 ![](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/How%20to%20Use%20the%20Table%20API_205534237.png) 该按钮将提供有关测试用 API 配置的更多信息。请在相应字段中输入以下内容: - 用户名:API密钥 - 密码:密钥 点击“授权”后,您即可开始测试针对表格的一些常见 HTTP 请求。 ![](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/How%20to%20Use%20the%20Table%20API_205535341.png) 本页面中的每个选项均可展开并进行测试。每个请求都会提供关于相应响应的有用信息。 本页面还提供了关于 Tulip 部分组件的模式信息。例如,要创建表记录,了解每列的正确 JSON 格式非常有用。列的示例模式如下所示: ![](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/How%20to%20Use%20the%20Table%20API_205536066.png)