创建 workforceIntegration

命名空间:microsoft.graph

创建新的 workforceIntegration 对象。

API 可用性

此 API 可用于以下国家级云部署。

全局服务 美国政府 L4 美国政府 L5 (DOD) 由世纪互联运营的中国
✅ ❌ ❌ ❌

权限

为此 API 选择标记为最低特权的权限。 只有在应用需要它时,才使用更高的特权权限。 有关委派权限和应用程序权限的详细信息,请参阅权限类型。 要了解有关这些权限的详细信息,请参阅 权限参考。

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

注意:此 API 支持管理员权限。 具有管理员角色的用户可以访问他们不属于的组。

HTTP 请求

POST /teamwork/workforceIntegrations

请求标头

名称 说明
Authorization 持有者 {token}。 必填。 详细了解 身份验证和授权。
Content-type application/json. 必需。
MS-APP-ACTS-AS (已弃用) 用户 ID (GUID) 。 仅当授权令牌是应用程序令牌时才需要;否则为可选。 MS-APP-ACTS-AS标头已弃用,不再需要应用程序令牌。

请求正文

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

下表列出了创建 workforceIntegration 对象时可以使用的属性。

属性 类型 说明
apiVersion Int32 回调 URL 的 API 版本。 从 1 开始。
displayName String 劳动力集成的名称。
eligibilityFilteringEnabledEntities eligibilityFilteringEnabledEntities 支持查看经过资格筛选的结果。 可能的值包括 none、swapRequest、offerShiftRequest、unknownFutureValue、timeOffReason。 使用 Prefer: include-unknown-enum-members 请求标头获取此 可进化枚举中的以下成员: timeOffReason.
加密 workforceIntegrationEncryption 劳动力集成加密资源。
isActive 布尔值 指示此劳动力集成当前是否处于活动状态并可用。
supportedEntities workforceIntegrationSupportedEntities 同步更改通知支持的排班实体。 当客户端对此属性中指定的实体发生更改时,班次将调用提供的 URL。 默认情况下,更改通知不支持任何实体。 可能的值为: none、 、 userShiftPreferencestimeOffReasontimeOffswapRequestopenShiftRequesttimeOffRequestopenShiftofferShiftRequestunknownFutureValuetimeCardshift 使用 Prefer: include-unknown-enum-members 请求标头获取此 可进化枚举中的以下值: timeCard, , timeOffReasontimeOfftimeOffRequest, .
url String 用于从 Shifts 服务回调的劳动力集成 URL。

响应

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

示例

请求

以下示例显示了一个请求。

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

{
  "displayName": "ABCWorkforceIntegration",
  "apiVersion": 1,
  "isActive": true,
  "encryption": {
    "protocol": "sharedSecret",
    "secret": "My Secret"
  },
  "url": "https://ABCWorkforceIntegration.com/Contoso/",
  "supportedEntities": "Shift,SwapRequest",
  "eligibilityFilteringEnabledEntities": "SwapRequest"
}

响应

以下示例显示了相应的响应。

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

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

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

WorkforceIntegration 实体的用例示例 按劳动力管理系统 (WFM) 规则筛选资格

用例:创建新的 WorkforceIntegration,启用了 SwapRequest 以进行资格筛选

请求

以下示例显示了一个请求。

POST https://graph.microsoft.com/v1.0/teamwork/workforceIntegrations/
Authorization: Bearer {token}
Content-type: application/json

{
  "displayName": "ABCWorkforceIntegration",
  "apiVersion": 1,
  "isActive": true,
  "encryption": {
    "protocol": "sharedSecret",
    "secret": "My Secret"
  },
  "url": "https://ABCWorkforceIntegration.com/Contoso/",
  "supportedEntities": "Shift,SwapRequest",
  "eligibilityFilteringEnabledEntities": "SwapRequest"
}

响应

以下示例显示了相应的响应。

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/",
  "supportedEntities": "Shift,SwapRequest",
  "eligibilityFilteringEnabledEntities": "SwapRequest"
}

若要了解如何在启用 SwapRequest 的情况下更新现有 workforceIntegration 以进行资格筛选,请参阅 更新。

当 SwapRequest 包含在 eligibilityFilteringEnabledEntities 中时提取符合条件的班次的示例

Shifts 应用与劳动力集成终结点之间的交互遵循现有模式。

请求

此示例显示 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": [
    "id": "{shiftId}",
    "status: 200,
    "body": {
       "data": [{shiftId}, {shiftId}...]
       "error": null
    }
  ]
}