Create externalItem

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 a new externalItem.

This API can be used to create a custom item. The containing externalConnection must have a schema registered of the corresponding type.

Permissions

One of the following permissions is required to call this API. To learn more, including how to choose permissions, see Permissions.

Permission type Permissions (from least to most privileged)
Delegated (work or school account) ExternalItem.ReadWrite.OwnedBy, ExternalItem.ReadWrite.All
Delegated (personal Microsoft account) Not supported.
Application ExternalItem.ReadWrite.OwnedBy, ExternalItem.ReadWrite.All

HTTP request

PUT /external/connections/{connection-id}/items/{item-id}

Path parameters

Parameter Type Description
connection-id string The id property of the containing externalConnection
item-id string The developer-provided id property of the externalItem. If no item already exists with this id, a new item is created. If an item already exists with this id, it is overwritten by the object sent in the body.

Request headers

Name Description
Authorization Bearer {token}. Required.
Content-Type application/json. Required.

Request body

In the request body, supply a JSON representation of an externalItem object. The payload is limited to 4 MB.

Creating an externalItem

When creating an externalItem, the following fields are required: acl, and properties. The properties object must contain at least one property.

All DateTime type properties must be in ISO 8601 format.

Properties on an externalItem should use type specifiers in the payload in the following scenarios:

  • For String type properties, if the value contains non-ASCII characters.

    "description@odata.type": "String",
    "description": "Kandierte Äpfel"
    
  • For all collection types.

    "categories@odata.type": "Collection(String)"
    "categories": [
      "red",
      "blue"
    ]
    

    Important

    When including a property of type Collection(DateTime), you must use the type specifier Collection(DateTimeOffset).

Response

If successful, this method returns 200 OK response code.

Examples

Example: Create a custom item

Request

The following is an example of the request.

PUT https://graph.microsoft.com/beta/external/connections/contosohr/items/TSP228082938
Content-type: application/json

{
  "acl": [
    {
      "type": "user",
      "value": "e811976d-83df-4cbd-8b9b-5215b18aa874",
      "accessType": "grant",
      "identitySource": "azureActiveDirectory"
    },
    {
      "type": "group",
      "value": "14m1b9c38qe647f6a",
      "accessType": "deny",
      "identitySource": "external"
    }
  ],
  "properties": {
    "title": "Error in the payment gateway",
    "priority": 1,
    "assignee": "john@contoso.com"
  },
  "content": {
    "value": "Error in payment gateway...",
    "type": "text"
  }
}

Response

The following is an example of the response.

HTTP/1.1 200 OK