Create Workforce Integration using the graph API - microsoft-graph-api

I am using this endpoint in POSTMAN: Endpoint: https://graph.microsoft.com/v1.0/teamwork/workforceIntegrations
with requst body
Request body:
{
"apiVersion": 1,
"displayName": "samplename",
"encryption": {
"protocol": "sharedSecret",
"secret": "someescretvalueasper the doc"
},
"isActive": true,
"supportedEntities": "shift",
"url": "sampleurl.com"
}
I have followed all steps as mentioned in the documentation here https://learn.microsoft.com/en-us/graph/api/workforceintegration-post?view=graph-rest-1.0&tabs=http
however I am getting this error
{
"error": {
"code": "BadRequest",
"message": "{\"error\":{\"title\":\"Something went wrong\",\"externalErrorMessage\":\"Bad Request\",\"externalSource\":\"ShiftBookingsFlow\",\"externalImageLink\":null,\"externalData\":null,\"code\":\"BadRequest\",\"message\":\"Sorry your change couldn’t be completed.\",\"details\":[],\"innererror\":{\"code\":\"WorkforceIntegrationError\"}}}",
"innerError": {
"date": "2022-12-18T23:47:36",
"request-id": "d8e370a1-1d63-4137-9b49-07c74df6861b",
"client-request-id": "d8e370a1-1d63-4137-9b49-07c74df6861b"
}
}
}
Can anyone help me understand what I am doing wrong over here?
I expect a 200 Ok response but it is giving 400 bad request.
Is there any pre-requirsite to this API?

Related

Graph API search query error - Unexpected segment DynamicPathSegment. Expected property/$value

I am unable to search using microsoft graph api. The documentation is here.
Below is the sample provided in documentation, which itself is not working. Can someone suggest please. I actually want to search for people (and as per documentation /search is recommended way over /people. with /people query I am getting issue as faced in another thread)
URL : https://graph.microsoft.com/v1.0/users/<my mailbox name>/search/query
Request data:
{
"requests": [
{
"entityTypes": [
"message"
],
"query": {
"queryString": "contoso"
},
"from": 0,
"size": 25
}
]
}
Response:
{
"error": {
"code": "Request_BadRequest",
"message": "Unexpected segment DynamicPathSegment. Expected property/$value.",
"innerError": {
"date": "2023-01-18T16:19:05",
"request-id": "29a310fe-b5cf-4ea1-a995-3a09941d6d13",
"client-request-id": "29a310fe-b5cf-4ea1-a995-3a09941d6d13"
}
}
}
Send the POST request to https://graph.microsoft.com/beta/search/query endpoint.
POST https://graph.microsoft.com/beta/search/query
Request body
{
"requests": [
{
"entityTypes": [
"person"
],
"query": {
"queryString": "Sandeep"
},
"from": 0,
"size": 25
}
]
}
Searching for people requires delegated permissions.
Searching only works for searching the signed-in user's relevant people, not for searching people relevant to other users.

Is there a way to post a message with a code snippet?

The new way to upload images as hosted content through the Send Message endpoint is great! However, is there a way to upload text/plain as hosted content in order to post a Code Snippet Card in a message?
I have tried uploading text but the response gives me an error that says that the only content types allowed are 'image/jpg,image/jpeg,image/png'.
Example request:
{
"body": {
"contentType": "html",
"content": "<attachment id=\"4d92eb51ab9c48ebb5b364794a2fa569\"></attachment>"
},
"attachments": [
{
"id": "4d92eb51ab9c48ebb5b364794a2fa569",
"contentType": "application/vnd.microsoft.card.codesnippet",
"contentUrl": null,
"content": "{\"name\":\"\",\"language\":\"CSharp\",\"lines\":1,\"wrap\":false,\"codeSnippetUrl\":\"../hostedContents/1/$value\"}",
"name": null,
"thumbnailUrl": null
}
],
"hostedContents":[
{
"#microsoft.graph.temporaryId": "1",
"contentBytes": "VGVzdA==",
"contentType": "text/plain"
}
]
}
Response:
{
"error": {
"code": "BadRequest",
"message": "Unsupported content type in hostedContent with Id '1'. Allowed values are 'image/jpg,image/jpeg,image/png'",
"innerError": {
"date": "2020-10-07T12:17:15",
"request-id": "ed24f5df-3e1f-4871-b430-e4c1c9f30348",
"client-request-id": "ed24f5df-3e1f-4871-b430-e4c1c9f30348"
}
}
}
I received an answer in the Documentation GitHub: https://github.com/microsoftgraph/microsoft-graph-docs/issues/10210#issuecomment-705050649
Code snippets are not supported at the moment. They are on list of things to support, but there is no timeline to share yet.

Microsoft Graph API - Get subscriptions issue

I have tried to get subscriptions list
GET https://graph.microsoft.com/v1.0/subscriptions
And got the response:
{
"error": {
"code": "QueryNotSupported",
"message": "Get Subscriptions list is not supported for the API version 1.0.",
"innerError": {
"request-id": "39473acc-179a-4a41-beba-0dd7887c299b",
"date": "2019-09-17T07:49:12"
}
}
}
The same request is eventually working during the last couple of hours.
Are there some migration activities with Graph API?
Thank you
Update:
Subscriptions getting is working now, but when I got subscription's id
{
"id": "45f46028-2f93-4167-947a-2a1dda035226",
"resource": "users/****/events",
"applicationId": "***",
"changeType": "created,updated,deleted",
"clientState": null,
"notificationUrl": "******",
"expirationDateTime": "2019-09-19T19:46:53.934Z",
"creatorId": "****"
},
and tried to delete it:
DELETE https://graph.microsoft.com/v1.0/subscriptions/45f46028-2f93-4167-947a-2a1dda035226
I got the response:
{
"error": {
"code": "ResourceNotFound",
"message": "The object was not found.",
"innerError": {
"request-id": "c485edd8-cc2e-461b-8c90-2cb5cc8dbebd",
"date": "2019-09-19T08:51:46"
}
}
}
We are sorry, but we did have a degradation of service affecting those two operations (list and delete). It has been resolved since.

Error when set schedule for private video using Google APIs Explorer

Question: Why did I get this error? The error message is not informative/helpful. Please assist to solve.
I tried to simulate this on Google APIs Explorer:
https://developers.google.com/apis-explorer/#p/youtube/v3/youtube.videos.update
Part: status
{
"id": "3zZ1lCz-rp4",
"status": {
"privacyStatus": "private",
"publishAt": "2019-04-12T12:12:12.12Z"
}
}
But not working. Getting response:
{
"error": {
"errors": [
{
"domain": "youtube.video",
"reason": "invalidVideoMetadata",
"message": "The request metadata is invalid.",
"locationType": "other",
"location": "body"
}
],
"code": 400,
"message": "The request metadata is invalid."
}
}

Unable to update OneNote page content

I send a PATCH request to https://graph.microsoft.com/beta/me/onenote/pages/1-3e7c1460680d4fe28501792ccda64915!119-304d54d6-d499-49f0-b231-cb3a9248e4e9/content
with body
[
{
"action": "replace",
"target": "p:{3e7c1460-680d-4fe2-8501-792ccda64915}{197}",
"content": "<p data-tag=\"to-do:completed\" style=\"margin-top:0pt;margin-bottom:0pt\">Sdasdsad</p>"
}
]
And I get response 500 with body:
{
"error": {
"code": "19999",
"message": "Something failed, the API cannot share any more information at the time of the request.",
"innerError": {
"request-id": "574a3b34-c354-4603-a73e-981984a56758",
"date": "2018-09-24T08:23:02"
}
}
}
The error is persistent. Does anybody knows where I can get help?

Resources