Unable to update OneNote page content - microsoft-graph-api

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?

Related

Create Workforce Integration using the 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?

Trying to create team with owner using principal name, gives error "Failed to find users with user principal name" but user is owner of 365 account

Request URL
https://graph.microsoft.com/v1.0/teams
Request Body
{
"template#odata.bind": "https://graph.microsoft.com/v1.0/teamsTemplates('standard')",
"displayName": "Team22",
"description": "My Sample Team’s Description",
"members": [
{
"#odata.type": "#microsoft.graph.aadUserConversationMember",
"roles": [
"owner"
],
"user#odata.bind": "https://graph.microsoft.com/v1.0/users('vishalkumar#4vswmg.onmicrosoft.com')"
}
]
}
Response Code 404
Response Preview
{
"error": {
"code": "NotFound",
"message": "Failed to find users with user principal name 'vishalkumar#4vswmg.onmicrosoft.com'",
"innerError": {
"date": "2022-05-13T06:55:15",
"request-id": "9df9a8fa-21cc-4455-b39f-ef1aca1d4b07",
"client-request-id": "24d55bd6-3f77-b808-221e-3f1a7af7dd5a"
}
}
}
The following payload worked for me:
Ref Doc: https://learn.microsoft.com/en-us/graph/api/team-post?view=graph-rest-1.0&tabs=http#example-9-application-permissions-using-user-principal-name
"template#odata.bind":"https://graph.microsoft.com/v1.0/teamsTemplates('standard')",
"displayName":"My Sample Team",
"description":"My Sample Team’s Description",
"members":[
{
"#odata.type":"#microsoft.graph.aadUserConversationMember",
"roles":[
"owner"
],
"user#odata.bind":"https://graph.microsoft.com/v1.0/users('jacob#contoso.com')"
}
]
}```
Keep in mind you can add only one owner at the time of Team creation using Graph API

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."
}
}

Resources