API 访问权限
Data Service Open API allows you to manage UiPath® Data Service resources from an external application of your choice, and does so by enabling you to authorize the external app without sharing any credentials, through the Oauth 2.0 authorization framework.
Learn how to register the external application in UiPath® Automation Cloud.
要使用 Data Service OpenAPI,您必须向外部应用程序授予 API 权限。这些 API 权限称为作用域,Data Service 有以下三种类型的作用域:
- DataService.Schema.Read - 此用户作用域允许您的外部应用程序读取租户的 Data Service 架构,此作用域取决于用户的权限。
- DataService.Schema.Read - 此用户作用域允许您的外部应用程序读取租户的 Data Service 架构,此作用域取决于用户的权限。
- DataService.Data.Write - 此用户作用域允许您的外部应用程序通过删除、更新或新建数据来编辑租户的 Data Service 数据,此作用域取决于用户的权限。
详细了解 Data Service 中的 用户角色和权限 。
为外部应用程序和用户设置权限后,下载租户 Data Service 数据的 OpenAPI 规范:
-
On the Data Service page, click API Access, then select Download OpenAPI file (JSON).
此操作会以 JSON 格式下载租户 Data Service 实体的 OpenAPI 3.0 规范。
单击“复制 OpenAPI 链接”可复制生成租户 Data Service OpenAPI 规范的 API 端点。
通过为外部应用程序创建访问令牌,授权外部应用程序使用 Data Service OpenAPI。使用在注册外部应用程序时生成的应用程序 ID 和应用程序密钥。授权方法取决于应用程序的类型(机密或非机密)。
详细了解外部应用程序的授权方法。
OAuth2.0 授权框架可帮助您生成访问令牌,该令牌允许您的外部应用程序在有限的时间(一小时)内向 Data Service 端点发出 REST API 调用。 要继续调用 API,您需要生成新的访问令牌或请求刷新令牌。
Data Service API 端点具有以下语法:
-
HTTP 方法+ BaseURL +资源类别+ Data Service 实体+操作+路径变量和查询参数
为了描述每个 API 请求正文/响应正文,我们使用在 Data Service 中创建的“奥运会” 实体字段。
Get Entity Records
)时,端点将包含实体的确切名称(例如Get Olympics Records
)。响应正文和请求正文包含实体的所有字段,以复制实体的结构。
此外,让我们深入了解每个端点,并发现如何充分利用它们: