Namespace: microsoft.graph
Crie um novo objeto workforceIntegration .
Essa API está disponível nas seguintes implantações de nuvem nacional.
| Serviço global |
Governo dos EUA L4 |
US Government L5 (DOD) |
China operada pela 21Vianet |
| ✅ |
❌ |
❌ |
❌ |
Permissões
Escolha a(s) permissão(s) marcada(s) como menos privilegiada(s) para essa API. Use uma permissão ou permissões com privilégios mais altos somente se o aplicativo exigir. Para obter detalhes sobre permissões delegadas e de aplicativo, consulte Tipos de permissão. Para saber mais sobre essas permissões, consulte a referência de permissões.
| Tipo de permissão |
Permissões menos privilegiadas |
Permissões com privilégios mais elevados |
| Delegado (conta corporativa ou de estudante) |
WorkforceIntegration.ReadWrite.All |
Indisponível. |
| Delegado (conta pessoal da Microsoft) |
Sem suporte. |
Sem suporte. |
| Application |
WorkforceIntegration.ReadWrite.All |
Indisponível. |
Observação: esta API oferece transporte a permissões de administrador. Os usuários com funções de administrador podem acessar grupos dos quais não são membros.
Solicitação HTTP
POST /teamwork/workforceIntegrations
| Nome |
Descrição |
| Autorização |
{token} de portador. Obrigatório. Saiba mais sobre autenticação e autorização. |
| Content-type |
application/json. Obrigatório. |
| MS-APP-ACTS-AS (preterido) |
Uma ID de usuário (GUID). Necessário somente se o token de autorização for um token de aplicativo; caso contrário, opcional. O MS-APP-ACTS-AS cabeçalho foi preterido e não é mais necessário com tokens de aplicativo. |
Corpo da solicitação
No corpo da solicitação, forneça uma representação JSON do objeto workforceIntegration .
A tabela a seguir lista as propriedades que você pode usar ao criar um objeto workforceIntegration .
| Propriedade |
Tipo |
Descrição |
| apiVersion |
Int32 |
Versão da API para a URL de retorno de chamada. Comece com 1. |
| displayName |
Cadeia de caracteres |
Nome da integração da força de trabalho. |
| eligibilityFilteringEnabledEntities |
eligibilityFilteringEnabledEntities |
Suporte para exibir resultados filtrados por qualificação. Os valores possíveis são: none, swapRequest, offerShiftRequest, unknownFutureValue, timeOffReason. Use o cabeçalho da Prefer: include-unknown-enum-members solicitação para obter os seguintes membros nesta enumeração evolutiva: timeOffReason. |
| criptografia |
workforceIntegrationEncryption |
O recurso de criptografia de integração da força de trabalho. |
| isActive |
Booliano |
Indica se esta integração da força de trabalho está ativa e disponível no momento. |
| supportedEntities |
workforceIntegrationSupportedEntities |
As entidades Turnos com suporte para notificações de alteração síncronas. Os turnos chamam a URL fornecida quando ocorrem alterações de cliente nas entidades especificadas nesta propriedade. Por padrão, não há suporte para entidades para notificações de alteração. Os valores possíveis são: none, shift, swapRequest, userShiftPreferencestimeOffopenShiftopenShiftRequesttimeOffReasonofferShiftRequestunknownFutureValuetimeCard. timeOffRequest Use o cabeçalho da Prefer: include-unknown-enum-members solicitação para obter os seguintes valores nesta enumeração evolutiva: timeCard, timeOffReason , timeOff , timeOffRequest. |
| url |
Cadeia de caracteres |
URL de integração da força de trabalho usada para retornos de chamada do serviço Turnos. |
Resposta
Se for bem-sucedido, esse método retornará um código de 201 Created resposta e um novo objeto workforceIntegration no corpo da resposta.
Exemplos
Solicitação
O exemplo a seguir mostra uma solicitação.
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"
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
var requestBody = new WorkforceIntegration
{
DisplayName = "ABCWorkforceIntegration",
ApiVersion = 1,
IsActive = true,
Encryption = new WorkforceIntegrationEncryption
{
Protocol = WorkforceIntegrationEncryptionProtocol.SharedSecret,
Secret = "My Secret",
},
Url = "https://ABCWorkforceIntegration.com/Contoso/",
SupportedEntities = WorkforceIntegrationSupportedEntities.Shift | WorkforceIntegrationSupportedEntities.SwapRequest,
EligibilityFilteringEnabledEntities = EligibilityFilteringEnabledEntities.SwapRequest,
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Teamwork.WorkforceIntegrations.PostAsync(requestBody);
Para obter detalhes sobre como adicionar o SDK ao seu projeto e criar uma instância authProvider, consulte a documentação do SDK.
// Code snippets are only available for the latest major version. Current major version is $v1.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-sdk-go/models"
//other-imports
)
requestBody := graphmodels.NewWorkforceIntegration()
displayName := "ABCWorkforceIntegration"
requestBody.SetDisplayName(&displayName)
apiVersion := int32(1)
requestBody.SetApiVersion(&apiVersion)
isActive := true
requestBody.SetIsActive(&isActive)
encryption := graphmodels.NewWorkforceIntegrationEncryption()
protocol := graphmodels.SHAREDSECRET_WORKFORCEINTEGRATIONENCRYPTIONPROTOCOL
encryption.SetProtocol(&protocol)
secret := "My Secret"
encryption.SetSecret(&secret)
requestBody.SetEncryption(encryption)
url := "https://ABCWorkforceIntegration.com/Contoso/"
requestBody.SetUrl(&url)
supportedEntities := graphmodels.SHIFT,SWAPREQUEST_WORKFORCEINTEGRATIONSUPPORTEDENTITIES
requestBody.SetSupportedEntities(&supportedEntities)
eligibilityFilteringEnabledEntities := graphmodels.SWAPREQUEST_ELIGIBILITYFILTERINGENABLEDENTITIES
requestBody.SetEligibilityFilteringEnabledEntities(&eligibilityFilteringEnabledEntities)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
workforceIntegrations, err := graphClient.Teamwork().WorkforceIntegrations().Post(context.Background(), requestBody, nil)
Para obter detalhes sobre como adicionar o SDK ao seu projeto e criar uma instância authProvider, consulte a documentação do SDK.
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
WorkforceIntegration workforceIntegration = new WorkforceIntegration();
workforceIntegration.setDisplayName("ABCWorkforceIntegration");
workforceIntegration.setApiVersion(1);
workforceIntegration.setIsActive(true);
WorkforceIntegrationEncryption encryption = new WorkforceIntegrationEncryption();
encryption.setProtocol(WorkforceIntegrationEncryptionProtocol.SharedSecret);
encryption.setSecret("My Secret");
workforceIntegration.setEncryption(encryption);
workforceIntegration.setUrl("https://ABCWorkforceIntegration.com/Contoso/");
workforceIntegration.setSupportedEntities(EnumSet.of(WorkforceIntegrationSupportedEntities.Shift, WorkforceIntegrationSupportedEntities.SwapRequest));
workforceIntegration.setEligibilityFilteringEnabledEntities(EnumSet.of(EligibilityFilteringEnabledEntities.SwapRequest));
WorkforceIntegration result = graphClient.teamwork().workforceIntegrations().post(workforceIntegration);
Para obter detalhes sobre como adicionar o SDK ao seu projeto e criar uma instância authProvider, consulte a documentação do SDK.
const options = {
authProvider,
};
const client = Client.init(options);
const workforceIntegration = {
displayName: 'ABCWorkforceIntegration',
apiVersion: 1,
isActive: true,
encryption: {
protocol: 'sharedSecret',
secret: 'My Secret'
},
url: 'https://ABCWorkforceIntegration.com/Contoso/',
supportedEntities: 'Shift,SwapRequest',
eligibilityFilteringEnabledEntities: 'SwapRequest'
};
await client.api('/teamwork/workforceIntegrations')
.post(workforceIntegration);
Para obter detalhes sobre como adicionar o SDK ao seu projeto e criar uma instância authProvider, consulte a documentação do SDK.
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Models\WorkforceIntegration;
use Microsoft\Graph\Generated\Models\WorkforceIntegrationEncryption;
use Microsoft\Graph\Generated\Models\WorkforceIntegrationEncryptionProtocol;
use Microsoft\Graph\Generated\Models\WorkforceIntegrationSupportedEntities;
use Microsoft\Graph\Generated\Models\EligibilityFilteringEnabledEntities;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new WorkforceIntegration();
$requestBody->setDisplayName('ABCWorkforceIntegration');
$requestBody->setApiVersion(1);
$requestBody->setIsActive(true);
$encryption = new WorkforceIntegrationEncryption();
$encryption->setProtocol(new WorkforceIntegrationEncryptionProtocol('sharedSecret'));
$encryption->setSecret('My Secret');
$requestBody->setEncryption($encryption);
$requestBody->setUrl('https://ABCWorkforceIntegration.com/Contoso/');
$requestBody->setSupportedEntities(new WorkforceIntegrationSupportedEntities('shift,SwapRequest'));
$requestBody->setEligibilityFilteringEnabledEntities(new EligibilityFilteringEnabledEntities('swapRequest'));
$result = $graphServiceClient->teamwork()->workforceIntegrations()->post($requestBody)->wait();
Para obter detalhes sobre como adicionar o SDK ao seu projeto e criar uma instância authProvider, consulte a documentação do SDK.
Import-Module Microsoft.Graph.Teams
$params = @{
displayName = "ABCWorkforceIntegration"
apiVersion = 1
isActive = $true
encryption = @{
protocol = "sharedSecret"
secret = "My Secret"
}
url = "https://ABCWorkforceIntegration.com/Contoso/"
supportedEntities = "Shift,SwapRequest"
eligibilityFilteringEnabledEntities = "SwapRequest"
}
New-MgTeamworkWorkforceIntegration -BodyParameter $params
Para obter detalhes sobre como adicionar o SDK ao seu projeto e criar uma instância authProvider, consulte a documentação do SDK.
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.models.workforce_integration import WorkforceIntegration
from msgraph.generated.models.workforce_integration_encryption import WorkforceIntegrationEncryption
from msgraph.generated.models.workforce_integration_encryption_protocol import WorkforceIntegrationEncryptionProtocol
from msgraph.generated.models.workforce_integration_supported_entities import WorkforceIntegrationSupportedEntities
from msgraph.generated.models.eligibility_filtering_enabled_entities import EligibilityFilteringEnabledEntities
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = WorkforceIntegration(
display_name = "ABCWorkforceIntegration",
api_version = 1,
is_active = True,
encryption = WorkforceIntegrationEncryption(
protocol = WorkforceIntegrationEncryptionProtocol.SharedSecret,
secret = "My Secret",
),
url = "https://ABCWorkforceIntegration.com/Contoso/",
supported_entities = WorkforceIntegrationSupportedEntities.Shift | WorkforceIntegrationSupportedEntities.SwapRequest,
eligibility_filtering_enabled_entities = EligibilityFilteringEnabledEntities.SwapRequest,
)
result = await graph_client.teamwork.workforce_integrations.post(request_body)
Para obter detalhes sobre como adicionar o SDK ao seu projeto e criar uma instância authProvider, consulte a documentação do SDK.
Resposta
O exemplo a seguir mostra a resposta.
Observação: o objeto de resposta mostrado aqui pode ser encurtado para legibilidade.
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"
}
Exemplos de casos de uso da entidade WorkforceIntegration para filtragem de elegibilidade por regras do sistema de gerenciamento de força de trabalho (WFM)
Caso de uso: Criar um novo WorkforceIntegration com SwapRequest habilitado para filtragem de qualificação
Solicitação
O exemplo a seguir mostra uma solicitação.
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"
}
Resposta
O exemplo a seguir mostra a resposta.
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"
}
Para ver como atualizar uma força de trabalho existenteIntegration com SwapRequest habilitado para filtragem de qualificação, consulte Atualizar.
Exemplo de busca de turnos qualificados quando SwapRequest está incluído em eligibilityFilteringEnabledEntities
A interação entre o aplicativo Turnos e os pontos de extremidade de integração da força de trabalho segue o padrão existente.
Solicitação
Este exemplo mostra uma solicitação feita pelo Shifts ao ponto de extremidade de integração da força de trabalho para buscar turnos qualificados para uma solicitação de troca.
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}”
}]
}
Resposta
O exemplo a seguir mostra a resposta do serviço de integração da força de trabalho.
HTTP/1.1 200 OK
{
"responses": [
"id": "{shiftId}",
"status: 200,
"body": {
"data": [{shiftId}, {shiftId}...]
"error": null
}
]
}