Create schema

Namespace: microsoft.graph.externalConnectors

Important

APIs under the /beta version in Microsoft Graph are subject to change. Use of these APIs in production applications is not supported. To determine whether an API is available in v1.0, use the Version selector.

Create the schema for a Microsoft Search connection.

This API is available in the following national cloud deployments.

Global service US Government L4 US Government L5 (DOD) China operated by 21Vianet

Permissions

Choose the permission or permissions marked as least privileged for this API. Use a higher privileged permission or permissions only if your app requires it. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference.

Permission type Least privileged permissions Higher privileged permissions
Delegated (work or school account) ExternalConnection.ReadWrite.OwnedBy ExternalConnection.ReadWrite.All
Delegated (personal Microsoft account) Not supported. Not supported.
Application ExternalConnection.ReadWrite.OwnedBy ExternalConnection.ReadWrite.All

HTTP request

PATCH /external/connections/{id}/schema

Request headers

Name Description
Authorization Bearer {token}. Required. Learn more about authentication and authorization.
Content-Type application/json. Required.
Prefer: respond-async Use this to cause the request to execute asynchronously. Optional.

Request body

In the request body, supply a JSON representation of a schema object.

When you register a custom item schema, the schema object must have the baseType property set to microsoft.graph.externalItem and must contain the properties property. The properties object must contain at least one property, up to a maximum of 128.

Response

If successful, this method returns a 202 Accepted response code and a URL in the Location response header that can be used to get the operation status.

Note: It can take between 5 and 15 minutes for the schema to get created. We recommend that you use the URL in the Location response header to get the operation status.

Examples

Request

The following example shows a request to register a custom schema asynchronously.

PATCH 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"
    }
  ]
}

Response

The following example shows the response.

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