Espacio de nombres: microsoft.graph
Cree un nuevo objeto workforceIntegration .
Esta API está disponible en las siguientes implementaciones nacionales de nube.
| Servicio global |
Gobierno de EE. UU. L4 |
Us Government L5 (DOD) |
China operada por 21Vianet |
| ✅ |
❌ |
❌ |
❌ |
Permissions
Elija el permiso o los permisos marcados como con privilegios mínimos para esta API. Use un permiso o permisos con privilegios superiores solo si la aplicación lo requiere. Para obtener más información sobre los permisos delegados y de aplicación, consulte Tipos de permisos. Para obtener más información sobre estos permisos, consulte la referencia de permisos.
| Tipo de permiso |
Permisos con privilegios mínimos |
Permisos con privilegios más altos |
| Delegado (cuenta profesional o educativa) |
WorkforceIntegration.ReadWrite.All |
No disponible. |
| Delegado (cuenta personal de Microsoft) |
No admitida. |
No admitida. |
| Aplicación |
WorkforceIntegration.ReadWrite.All |
No disponible. |
Nota: esta API admite permisos de administrador. Los usuarios con roles de administrador pueden acceder a grupos de los que no son miembros.
Solicitud HTTP
POST /teamwork/workforceIntegrations
| Nombre |
Descripción |
| Authorization |
{token} de portador. Obligatorio. Obtenga más información sobre la autenticación y la autorización. |
| Tipo de contenido |
application/json. Obligatorio. |
| MS-APP-ACTS-AS (en desuso) |
Un identificador de usuario (GUID). Solo se requiere si el token de autorización es un token de aplicación; De lo contrario, es opcional. El MS-APP-ACTS-AS encabezado está en desuso y ya no es necesario con tokens de aplicación. |
Cuerpo de la solicitud
En el cuerpo de la solicitud, proporcione una representación JSON del objeto workforceIntegration .
En la tabla siguiente se enumeran las propiedades que puede usar al crear un objeto workforceIntegration .
| Propiedad |
Tipo |
Description |
| apiVersion |
Int32 |
Versión de API para la dirección URL de devolución de llamada. Comience con 1. |
| displayName |
Cadena |
Nombre de la integración del personal. |
| eligibilityFilteringEnabledEntities |
eligibilityFilteringEnabledEntities |
Compatibilidad para ver los resultados filtrados por idoneidad. Los valores posibles son: none, swapRequest, offerShiftRequest, unknownFutureValue, timeOffReason. Use el encabezado de Prefer: include-unknown-enum-members solicitud para obtener los siguientes miembros en esta enumeración evolvable: timeOffReason. |
| cifrado |
workforceIntegrationEncryption |
Recurso de cifrado de integración de la fuerza de trabajo. |
| isActive |
Booleano |
Indica si esta integración del personal está activa y disponible actualmente. |
| supportedEntities |
workforceIntegrationSupportedEntities |
Las entidades Shifts admitidas para las notificaciones de cambio sincrónicas. Los turnos llaman a la dirección URL proporcionada cuando se producen cambios en el cliente en las entidades especificadas en esta propiedad. De forma predeterminada, no se admite ninguna entidad para las notificaciones de cambio. Los valores posibles son: none, shift, , swapRequest, openShiftuserShiftPreferences, openShiftRequest, , offerShiftRequest, unknownFutureValue, timeCard, timeOffReason, , timeOff. timeOffRequest Use el encabezado de Prefer: include-unknown-enum-members solicitud para obtener los siguientes valores en esta enumeración evolvable: timeCard, timeOffReason , timeOff , timeOffRequest. |
| URL |
Cadena |
Dirección URL de integración de Workforce usada para las devoluciones de llamada del servicio Shifts. |
Respuesta
Si se ejecuta correctamente, este método devuelve un 201 Created código de respuesta y un nuevo objeto workforceIntegration en el cuerpo de la respuesta.
Ejemplos
Solicitud
En el ejemplo siguiente se muestra la solicitud.
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 obtener más información sobre cómo agregar el SDK al proyecto y crear una instancia de authProvider, consulte la documentación del 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 obtener más información sobre cómo agregar el SDK al proyecto y crear una instancia de authProvider, consulte la documentación del 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 obtener más información sobre cómo agregar el SDK al proyecto y crear una instancia de authProvider, consulte la documentación del 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 obtener más información sobre cómo agregar el SDK al proyecto y crear una instancia de authProvider, consulte la documentación del 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 obtener más información sobre cómo agregar el SDK al proyecto y crear una instancia de authProvider, consulte la documentación del 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 obtener más información sobre cómo agregar el SDK al proyecto y crear una instancia de authProvider, consulte la documentación del 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 obtener más información sobre cómo agregar el SDK al proyecto y crear una instancia de authProvider, consulte la documentación del SDK.
Respuesta
En el ejemplo siguiente se muestra la respuesta.
Nota: Se puede acortar el objeto de respuesta que se muestra aquí para mejorar la legibilidad.
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"
}
Ejemplos de casos de uso de la entidad WorkforceIntegration para el filtrado de idoneidad por reglas del sistema de administración del personal (WFM)
Caso de uso: crear una nueva workforceintegration con SwapRequest habilitado para el filtrado de elegibilidad
Solicitud
En el ejemplo siguiente se muestra la solicitud.
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"
}
Respuesta
En el ejemplo siguiente se muestra la respuesta.
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 cómo actualizar una plantilla existenteIntegración con SwapRequest habilitado para el filtrado de idoneidad, consulte Actualización.
Ejemplo de captura de turnos válidos cuando SwapRequest se incluye en eligibilityFilteringEnabledEntities
La interacción entre la aplicación Shifts y los puntos de conexión de integración del personal sigue el patrón existente.
Solicitud
En este ejemplo se muestra una solicitud realizada por Shifts al punto de conexión de integración del personal para capturar turnos aptos para una solicitud de intercambio.
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}”
}]
}
Respuesta
En el ejemplo siguiente se muestra la respuesta del servicio de integración del personal.
HTTP/1.1 200 OK
{
"responses": [
"id": "{shiftId}",
"status: 200,
"body": {
"data": [{shiftId}, {shiftId}...]
"error": null
}
]
}