创建架构

命名空间:microsoft.graph.externalConnectors

重要

Microsoft Graph版本下的 /beta API 可能会发生更改。 不支持在生产应用程序中使用这些 API。 若要确定 API 是否在 v1.0 中可用,请使用 版本 选择器。

为Microsoft 搜索连接创建架构。

权限

要调用此 API,需要以下权限之一。要了解详细信息,包括如何选择权限的信息,请参阅权限

权限类型 权限(从最低特权到最高特权)
委派(工作或学校帐户) ExternalConnection.ReadWrite.OwnedBy,ExternalConnection.ReadWrite.All
委派(个人 Microsoft 帐户) 不支持。
应用程序 ExternalConnection.ReadWrite.OwnedBy,ExternalConnection.ReadWrite.All

HTTP 请求

POST /external/connections/{id}/schema

请求标头

名称 说明
Authorization Bearer {token}。必需。
Content-Type application/json. Required.
首选:respond-async 使用此命令可使请求异步执行。 可选。

请求正文

在请求正文中,提供 架构 对象的 JSON 表示形式。

注册自定义项架构时, 架构 对象 必须baseType 属性设置为 microsoft.graph.externalItem 并且 必须 包含 属性 属性。 properties 对象 必须 至少包含一个属性,最多 128 个属性。

响应

如果成功,此方法会在响应标头中Location返回202 Accepted响应代码和 URL,该 URL 可用于获取操作状态

示例

示例:异步注册自定义架构

请求

下面展示了示例请求。

POST https://graph.microsoft.com/beta/external/connections/contosohr/schema
Content-type: application/json

{
  "baseType": "microsoft.graph.externalItem",
  "properties": [
    {
      "name": "ticketTitle",
      "type": "string",
      "isSearchable": "true",
      "isRetrievable": "true",
      "labels": [
        "title"
      ]
    },
    {
      "name": "priority",
      "type": "string",
      "isQueryable": "true",
      "isRetrievable": "true",
      "isSearchable": "false"
    },
    {
      "name": "assignee",
      "type": "string",
      "isRetrievable": "true"
    }
  ]
}

响应

下面展示了示例响应。

HTTP/1.1 202 Accepted
Location: https://graph.microsoft.com/beta/external/connections/contosohr/operations/616bfeed-666f-4ce0-8cd9-058939010bfc