更新 workforceintegration

命名空间:microsoft.graph

重要

Microsoft Graph /beta 版本下的 API 可能会发生更改。 不支持在生产应用程序中使用这些 API。 若要确定 API 是否在 v1.0 中可用,请使用 版本 选择器。

更新 workforceintegration 对象的属性。

API 可用性

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

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

权限

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

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

HTTP 请求

PATCH /teamwork/workforceIntegrations/{workforceIntegrationId}

请求标头

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

请求正文

在请求正文中,提供应更新的相关字段的值。 请求正文中未包含的现有属性将保留其以前的值或根据其他属性值的更改重新计算。 为了获得最佳性能,请勿加入尚未更改的现有值。

属性 类型 说明
apiVersion Int32 回调 URL 的 API 版本。 从 1 开始。
displayName String 劳动力集成的名称。
加密 workforceIntegrationEncryption 劳动力集成加密资源。
isActive 布尔值 指示此劳动力集成当前是否处于活动状态并可用。
支撑 string 可能的值为 none、 、 shiftswapRequestopenshift、 openShiftRequestuserShiftPreferences、 。 如果选择多个值,所有值必须以第一个大写字母开头。
supportedEntities string 此属性替换 v1.0 中的 支持 。 建议使用此属性,而不是 使用支撑。 支持属性暂时在 Beta 版中仍受支持。 可能的值为 none、 、 shiftswapRequestopenshift、 openShiftRequestuserShiftPreferences、 。 如果选择多个值,所有值必须以第一个大写字母开头。
url String 来自 Shift 服务的回调的劳动力集成 url。

响应

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

示例

示例 1:更新 workforceIntegration 对象

以下示例更新 workforceIntegration 对象。

请求

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

PATCH https://graph.microsoft.com/beta/teamwork/workforceIntegrations/{workforceIntegrationId}
Content-type: application/json

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

响应

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

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

HTTP/1.1 200 OK
Content-type: application/json

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

示例 2:创建新的 workforceIntegration,启用 SwapRequest 以进行资格筛选

以下示例创建新的 workforceIntegration ,其中启用了 SwapRequest 以进行资格筛选。

请求

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

POST https://graph.microsoft.com/beta/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/",
  "supports": "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/",
  "supports": "Shift,SwapRequest",
  "eligibilityFilteringEnabledEntities": "SwapRequest"
}

若要创建已启用 SwapRequest 以进行资格筛选的新 workforceIntegration ,请参阅 Create 方法。

示例 3:当 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": [
  {
    "body": {
      "SHFT_6548f642-cbc1-4228-8621-054327576457",
      "SHFT_6548f642-cbc1-4228-8621-054327571234"
  }
    "id": "{shiftId}",
    "status: 200,
    "body": {
       "data": [{ShiftId}, {ShiftId}...]
       "error": null
    }
  ]
}

示例 4:启用时间卡更改实时通知时,将同步回调转移到劳动力集成终结点。

请求

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

POST https://foobarWorkforceIntegration.com/foobar/v1/teams/788b75d2-a911-48c0-a5e2-dc98480457e3/update
Accept-Language: en-us
X-MS-WFMPassthrough: foobarvalue
Content-type: application/json
{
   "requests":[
      {
         "id":"1",
         "method":"POST",
         "url":"/timecards",
         "headers":{
            "X-MS-Transaction-ID":"1"
         },
         "body":{
            "id":"3895809b-a618-4c0d-86a0-d42b25b7d74f",
            "userId":"a3601044-a1b5-438e-b742-f78d01d68a67",
            "createdDateTime":"2019-03-18T00:00:00.000Z",
            "createdBy":{
               "user":{
                  "id":"a3601044-a1b5-438e-b742-f78d01d68a67",
                  "displayName":"Dwight Schrute"
               }
            },
            "lastModifiedDateTime":"2019-03-18T00:00:00.000Z",
            "lastModifiedBy":{
               "user":{
                  "id":"a3601044-a1b5-438e-b742-f78d01d68a67",
                  "displayName":"Dwight Schrute"
               }
            },
            "state":"onBreak",
            "clockIn":{
               "dateTime":"2019-03-18T00:00:00.000Z",
               "atApprovedLocation":true,
               "notes":null
            },
            "clockOut":null,
            "breaks":[
               {
                  "id":"string",
                  "notes":{
                     "content":"Lunch break",
                     "contentType":"text"
                  },
                  "start":{
                     "dateTime":"2019-03-18T00:00:00.000Z",
                     "atApprovedLocation":true,
                     "notes":{
                        "content":"Started my break 5 minutes early",
                        "contentType":"text"
                     }
                  },
                  "end":null
               }
            ],
            "notes":null,
            "originalEntry":{
               "clockIn":{
                  "dateTime":"2019-03-18T00:00:00.000Z",
                  "atApprovedLocation":true,
                  "notes":null
               },
               "clockOut":null,
               "breaks":[
                  {
                     "id":"4591109b-a618-3e0d-e6a0-d42b25b7231f",
                     "notes":{
                        "content":"Lunch break",
                        "contentType":"text"
                     },
                     "start":{
                        "dateTime":"2019-03-18T00:00:00.000Z",
                        "atApprovedLocation":true,
                        "notes":{
                           "content":"Started my break 5 minutes early",
                           "contentType":"text"
                        }
                     },
                     "end":null
                  }
               ]
            }
         }
      }
   ]
}

响应

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

HTTP/1.1 200 OK
Content-type: application/json
{
  "responses":[
    {
      "id": "1",
      "status": 200,
      "body":{
        "eTag": "4000ee23-0000-0700-0000-5d1415f60000",
        "error": null
      }
    }
  ]
}