WorkforceIntegration erstellen
Artikel
07/18/2022
4 Minuten Lesedauer
3 Mitwirkende
In diesem Artikel
Namespace: microsoft.graph
Erstellen sie ein neues workforceIntegration-Objekt.
Sie können festlegen, für welche Entitäten synchrone Änderungsbenachrichtigungen für Schichten empfangen werden sollen, und Entitäten festlegen, für die die Filterung nach WFM-Regeln konfiguriert werden soll, einschließlich Swapanforderungen.
Berechtigungen
Eine der nachfolgenden Berechtigungen ist erforderlich, um diese API aufrufen zu können. Weitere Informationen, unter anderem zur Auswahl von Berechtigungen, finden Sie im Artikel zum Thema Berechtigungen .
Berechtigungstyp
Berechtigungen (von der Berechtigung mit den wenigsten Rechten zu der mit den meisten Rechten)
Delegiert (Geschäfts-, Schul- oder Unikonto)
WorkforceIntegration.ReadWrite.All
Delegiert (persönliches Microsoft-Konto)
Nicht unterstützt
Anwendung
Nicht unterstützt
Hinweis : Diese API unterstützt Administratorberechtigungen. Globale Administratoren können auf Gruppen zugreifen, bei denen sie kein Mitglied sind.
HTTP-Anforderung
POST /teamwork/workforceIntegrations
Name
Beschreibung
Authorization
Bearer {token}. Erforderlich.
Content-type
application/json. Erforderlich.
Anforderungstext
Geben Sie im Anforderungstext eine JSON-Darstellung eines WorkforceIntegration-Objekts an.
Antwort
Bei erfolgreicher Ausführung gibt die Methode den 201 Created Antwortcode und ein neues workforceIntegration-Objekt im Antworttext zurück.
Beispiele
Anforderung
Nachfolgend sehen Sie ein Beispiel der Anforderung.
POST https://graph.microsoft.com/v1.0/teamwork/workforceIntegrations
Content-type: application/json
{
"displayName": "displayName-value",
"apiVersion": 99,
"encryption": {
"protocol": "protocol-value",
"secret": "secret-value"
},
"isActive": true,
"url": "url-value",
"supportedEntities": "supportedEntities-value"
}
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var workforceIntegration = new WorkforceIntegration
{
DisplayName = "displayName-value",
ApiVersion = 99,
Encryption = new WorkforceIntegrationEncryption
{
Protocol = WorkforceIntegrationEncryptionProtocol.SharedSecret,
Secret = "secret-value"
},
IsActive = true,
Url = "url-value",
SupportedEntities = WorkforceIntegrationSupportedEntities.None
};
await graphClient.Teamwork.WorkforceIntegrations
.Request()
.AddAsync(workforceIntegration);
Ausführliche Informationen zum Hinzufügen des SDK zu Ihrem Projekt und zum Erstellen einer authProvider-Instanz finden Sie in der SDK-Dokumentation .
const options = {
authProvider,
};
const client = Client.init(options);
const workforceIntegration = {
displayName: 'displayName-value',
apiVersion: 99,
encryption: {
protocol: 'protocol-value',
secret: 'secret-value'
},
isActive: true,
url: 'url-value',
supportedEntities: 'supportedEntities-value'
};
await client.api('/teamwork/workforceIntegrations')
.post(workforceIntegration);
Ausführliche Informationen zum Hinzufügen des SDK zu Ihrem Projekt und zum Erstellen einer authProvider-Instanz finden Sie in der SDK-Dokumentation .
MSHTTPClient *httpClient = [MSClientFactory createHTTPClientWithAuthenticationProvider:authenticationProvider];
NSString *MSGraphBaseURL = @"https://graph.microsoft.com/v1.0/";
NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:[MSGraphBaseURL stringByAppendingString:@"/teamwork/workforceIntegrations"]]];
[urlRequest setHTTPMethod:@"POST"];
[urlRequest setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
MSGraphWorkforceIntegration *workforceIntegration = [[MSGraphWorkforceIntegration alloc] init];
[workforceIntegration setDisplayName:@"displayName-value"];
[workforceIntegration setApiVersion: 99];
MSGraphWorkforceIntegrationEncryption *encryption = [[MSGraphWorkforceIntegrationEncryption alloc] init];
[encryption setProtocol: [MSGraphWorkforceIntegrationEncryptionProtocol sharedSecret]];
[encryption setSecret:@"secret-value"];
[workforceIntegration setEncryption:encryption];
[workforceIntegration setIsActive: true];
[workforceIntegration setUrl:@"url-value"];
[workforceIntegration setSupportedEntities: [MSGraphWorkforceIntegrationSupportedEntities none]];
NSError *error;
NSData *workforceIntegrationData = [workforceIntegration getSerializedDataWithError:&error];
[urlRequest setHTTPBody:workforceIntegrationData];
MSURLSessionDataTask *meDataTask = [httpClient dataTaskWithRequest:urlRequest
completionHandler: ^(NSData *data, NSURLResponse *response, NSError *nserror) {
//Request Completed
}];
[meDataTask execute];
Ausführliche Informationen zum Hinzufügen des SDK zu Ihrem Projekt und zum Erstellen einer authProvider-Instanz finden Sie in der SDK-Dokumentation .
GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
WorkforceIntegration workforceIntegration = new WorkforceIntegration();
workforceIntegration.displayName = "displayName-value";
workforceIntegration.apiVersion = 99;
WorkforceIntegrationEncryption encryption = new WorkforceIntegrationEncryption();
encryption.protocol = WorkforceIntegrationEncryptionProtocol.SHARED_SECRET;
encryption.secret = "secret-value";
workforceIntegration.encryption = encryption;
workforceIntegration.isActive = true;
workforceIntegration.url = "url-value";
workforceIntegration.supportedEntities = EnumSet.of(WorkforceIntegrationSupportedEntities.NONE);
graphClient.teamwork().workforceIntegrations()
.buildRequest()
.post(workforceIntegration);
Ausführliche Informationen zum Hinzufügen des SDK zu Ihrem Projekt und zum Erstellen einer authProvider-Instanz finden Sie in der SDK-Dokumentation .
//THE GO SDK IS IN PREVIEW. NON-PRODUCTION USE ONLY
graphClient := msgraphsdk.NewGraphServiceClient(requestAdapter)
requestBody := msgraphsdk.NewWorkforceIntegration()
displayName := "displayName-value"
requestBody.SetDisplayName(&displayName)
apiVersion := int32(99)
requestBody.SetApiVersion(&apiVersion)
encryption := msgraphsdk.NewWorkforceIntegrationEncryption()
requestBody.SetEncryption(encryption)
protocol := "protocol-value"
encryption.SetProtocol(&protocol)
secret := "secret-value"
encryption.SetSecret(&secret)
isActive := true
requestBody.SetIsActive(&isActive)
url := "url-value"
requestBody.SetUrl(&url)
supportedEntities := "supportedEntities-value"
requestBody.SetSupportedEntities(&supportedEntities)
result, err := graphClient.Teamwork().WorkforceIntegrations().Post(requestBody)
Ausführliche Informationen zum Hinzufügen des SDK zu Ihrem Projekt und zum Erstellen einer authProvider-Instanz finden Sie in der SDK-Dokumentation .
Import-Module Microsoft.Graph.Teams
$params = @{
DisplayName = "displayName-value"
ApiVersion = 99
Encryption = @{
Protocol = "protocol-value"
Secret = "secret-value"
}
IsActive = $true
Url = "url-value"
SupportedEntities = "supportedEntities-value"
}
New-MgTeamworkWorkforceIntegration -BodyParameter $params
Ausführliche Informationen zum Hinzufügen des SDK zu Ihrem Projekt und zum Erstellen einer authProvider-Instanz finden Sie in der SDK-Dokumentation .
Antwort
Nachfolgend sehen Sie ein Beispiel der Antwort.
Hinweis: Das hier gezeigte Antwortobjekt kann zur besseren Lesbarkeit gekürzt werden.
HTTP/1.1 201 Created
Content-type: application/json
{
"displayName": "displayName-value",
"apiVersion": 99,
"encryption": {
"protocol": "protocol-value",
"secret": "secret-value"
},
"isActive": true,
"url": "url-value",
"supportedEntities": "supportedEntities-value"
}
Beispiele für Anwendungsfälle der WorkforceIntegration-Entität für die Filterung nach WFM-Regelberechtigung
Anwendungsfall: Erstellen eines neuen WorkforceIntegration mit aktivierter SwapRequest-Berechtigungsfilterung
Anforderung
Nachfolgend sehen Sie ein Beispiel der Anforderung.
POST https://graph.microsoft.com/v1.0/teamwork/workforceIntegrations/
{
"displayName": "ABCWorkforceIntegration",
"apiVersion": 1,
"isActive": true,
"encryption": {
"protocol": "sharedSecret",
"secret": "My Secret"
},
"url": "https://ABCWorkforceIntegration.com/Contoso/",
"supports": "Shift,SwapRequest",
"eligibilityFilteringEnabledEntities": "SwapRequest"
}
Authorization: Bearer {token}
Content-type: application/json
Antwort
Nachfolgend sehen Sie ein Beispiel der Antwort.
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"
}
Informationen zum Aktualisieren einer vorhandenen Workforceintegration mit SwapRequest, die für die Berechtigungsfilterung aktiviert ist, finden Sie unter Update .
Beispiel für das Abrufen berechtigter Schichten, wenn SwapRequest in "eligibilityFilteringEnabledEntities" enthalten ist
Die Interaktion zwischen der Shifts-App und den Endpunkten für die Integration der Mitarbeiter folgt dem vorhandenen Muster.
Anforderung
Im Folgenden sehen Sie ein Beispiel für die Anforderung von Schichten an den Integrationsendpunkt der Mitarbeiter, berechtigte Schichten für eine Swapanforderung abzurufen.
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}”
}]
}
Antwort
Es folgt ein Beispiel für die Antwort des Integrationsdiensts für Mitarbeiter.
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
}
]
}