Namespace: microsoft.graph
Criar um novo objeto workforceIntegration .
Esta API está disponível nas seguintes implementações de cloud nacionais.
| Serviço global |
US Government L4 |
US Government L5 (DOD) |
China operada pela 21Vianet |
| ✅ |
❌ |
❌ |
❌ |
Permissões
Escolha a permissão ou permissões marcadas como menos privilegiadas para esta API. Utilize uma permissão ou permissões com privilégios mais elevados apenas se a sua aplicação o exigir. Para obter detalhes sobre as permissões delegadas e de aplicação, veja Tipos de permissão. Para saber mais sobre estas permissões, veja a referência de permissões.
| Tipo de permissão |
Permissões com menos privilégios |
Permissões com privilégios superiores |
| 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 utilizadores com funções de administrador podem aceder a 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) |
Um ID de utilizador (GUID). Necessário apenas se o token de autorização for um token de aplicação; caso contrário, opcional. O MS-APP-ACTS-AS cabeçalho foi preterido e já não é necessário com tokens de aplicação. |
Corpo da solicitação
No corpo do pedido, forneça uma representação JSON do objeto workforceIntegration .
A tabela seguinte lista as propriedades que pode utilizar quando cria um objeto workforceIntegration .
| Propriedade |
Tipo |
Descrição |
| apiVersion |
Int32 |
Versão da API para o URL de chamada de retorno. Comece com 1. |
| displayName |
Cadeia de caracteres |
Nome da integração da força de trabalho. |
| eligibilityFilteringEnabledEntities |
eligibilityFilteringEnabledEntities |
Suporte para ver resultados filtrados por elegibilidade. Os valores possíveis são: none, swapRequest, offerShiftRequest, unknownFutureValue, timeOffReason. Utilize o cabeçalho do Prefer: include-unknown-enum-members pedido para obter os seguintes membros nesta enumeração em evolução: timeOffReason. |
| criptografia |
workforceIntegrationEncryption |
O recurso de encriptação de integração da força de trabalho. |
| isActive |
Booliano |
Indica se esta integração da força de trabalho está atualmente ativa e disponível. |
| supportedEntities |
workforceIntegrationSupportedEntities |
As entidades Shifts suportadas para notificações de alteração síncronas. Os turnos chamam o URL fornecido quando ocorrem alterações de cliente às entidades especificadas nesta propriedade. Por predefinição, não são suportadas entidades para notificações de alteração. Os valores possíveis são: none, , shift, swapRequest, userShiftPreferencesopenShift, openShiftRequest, offerShiftRequest, unknownFutureValue, timeCard, , timeOffReason, , . timeOffRequesttimeOff Utilize o cabeçalho do Prefer: include-unknown-enum-members pedido para obter os seguintes valores nesta enumeração evoluível: timeCard, timeOffReason , timeOff , timeOffRequest. |
| url |
Cadeia de caracteres |
URL de integração da força de trabalho utilizado para chamadas de retorno do serviço Turnos. |
Resposta
Se for bem-sucedido, este método devolve um 201 Created código de 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://v4.hkg1.meaqua.org/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://v4.hkg1.meaqua.org/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://v4.hkg1.meaqua.org/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 utilização da entidade WorkforceIntegration para Filtragem de Elegibilidade por regras do sistema de gestão da força de trabalho (WFM)
Caso de utilização: crie uma nova WorkforceIntegration com SwapRequest ativado para filtragem de elegibilidade
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 existenteIntegração com SwapRequest ativado para filtragem de elegibilidade, consulte Atualizar.
Exemplo de obtenção de turnos elegíveis quando SwapRequest está incluído na elegibilidadeFilteringEnabledEntities
A interação entre a aplicação Shifts e os pontos finais de integração da força de trabalho segue o padrão existente.
Solicitação
Este exemplo mostra um pedido feito por Turnos para o ponto final de integração da força de trabalho para obter turnos elegíveis para um pedido 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 seguinte 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
}
]
}