Create or update schema

Namespace: microsoft.graph.externalConnectors

Create a new or update an existing 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.

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 be 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 new or update an existing custom schema asynchronously.

PATCH https://graph.microsoft.com/v1.0/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/v1.0/external/connections/contosohr/operations/616bfeed-666f-4ce0-8cd9-058939010bfc