Create workforceIntegration

命名空间:microsoft.graph

创建新的 workforceIntegration 对象。 您可以设置要接收 Shifts 同步更改通知的实体,并设置实体以按 WFM 规则资格配置筛选,包括交换请求。

权限

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

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

注意:此 API 支持管理员权限。 全局管理员可以访问他们不是其成员组。

HTTP 请求

POST /teamwork/workforceIntegrations

请求标头

名称 说明
Authorization Bearer {token}。必需。
Content-type application/json. Required.

请求正文

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

响应

如果成功,此方法在响应正文中返回 响应代码和新的 201 Created workforceIntegration 对象。

示例

请求

下面展示了示例请求。

POST https://graph.microsoft.com/v1.0/teamwork/workforceIntegrations
Content-type: application/json

{
  "displayName": "displayName-value",
  "apiVersion": 99,
  "encryption": {
    "protocol": "protocol-value",
    "secret": "secret-value"
  },
  "isActive": true,
  "url": "url-value",
  "supportedEntities": "supportedEntities-value"
}

响应

下面展示了示例响应。

注意: 为了提高可读性,可能缩短了此处显示的响应对象。

HTTP/1.1 201 Created
Content-type: application/json

{
  "displayName": "displayName-value",
  "apiVersion": 99,
  "encryption": {
    "protocol": "protocol-value",
    "secret": "secret-value"
  },
  "isActive": true,
  "url": "url-value",
  "supportedEntities": "supportedEntities-value"
}

按 WFM 规则资格筛选的 WorkforceIntegration 实体用例示例

用例:新建一个启用 SwapRequest 进行资格筛选的 WorkforceIntegration

请求

下面展示了示例请求。

POST https://graph.microsoft.com/v1.0/teamwork/workforceIntegrations/
{
  "displayName": "ABCWorkforceIntegration",
  "apiVersion": 1,
  "isActive": true,
  "encryption": {
    "protocol": "sharedSecret",
    "secret": "My Secret"
  },
  "url": "https://ABCWorkforceIntegration.com/Contoso/",
  "supports": "Shift,SwapRequest",
  "eligibilityFilteringEnabledEntities": "SwapRequest"
}
Authorization: Bearer {token}
Content-type: application/json

响应

下面展示了示例响应。

HTTP/1.1 200 OK
{
  "id": "c5d0c76b-80c4-481c-be50-923cd8d680a1",
  "displayName": "ABCWorkforceIntegration",
  "apiVersion": 1,
  "isActive": true,
  "encryption": {
    "protocol": "sharedSecret",
    "secret": null
  },
  "url": "https://abcWorkforceIntegration.com/Contoso/",
  "supports": "Shift,SwapRequest",
  "eligibilityFilteringEnabledEntities": "SwapRequest"
}

若要了解如何使用启用了资格筛选的 SwapRequest 更新现有员工集成,请参阅 更新

当 SwapRequest 包含在 eligiblyFilteringEnabledEntities 中时提取合格班次的示例

班次应用和员工集成终结点之间的交互将遵循现有模式。

请求

下面是 Shifts 向员工集成终结点请求获取交换请求的合格班次的示例。

POST https://abcWorkforceIntegration.com/Contoso/{apiVersion}/team/{teamId}/read
Accept-Language: en-us
{
  "requests": [
  {
     "id": "{shiftId}",
     "method": "GET”,
     "url": “/shifts/{shiftId}/requestableShifts?requestType={requestType}&startDateTime={startDateTime}&endDateTime={endDateTime}”
   }]
}

响应

下面是员工集成服务的响应示例。

HTTP/1.1 200 OK
{
  "responses": [
  {
    "body": {
      "SHFT_6548f642-cbc1-4228-8621-054327576457",
      "SHFT_6548f642-cbc1-4228-8621-054327571234"
  }
    "id": "{shiftId}",
    "status: 200,
    "body": {
       "data": [{ShiftId}, {ShiftId}...]
       "error": null
    }
  ]
}