Office 365 unified API error "Resource not found for the segment 'UserPhotos'." - ms-office

A week or two ago, if a user had no photo the Office 365 unified API would return metadata for a photo of size 1X1. Now it's returning the error:
{
"error": {
"code": "RequestBrokerOld-ParseUri",
"message": "Resource not found for the segment 'UserPhotos'."
}
}
Now the error has started to appear for users that do have photos. It's been getting progressively worse over the last few days, to the point that the API is unusable now. It started off as only a few missing photos, and now only 1 user photo is returned successfully out of over 250 users.
All User Photo endpoints are returning this error. E.g:
https://graph.microsoft.com/beta/me/userphotos
https://graph.microsoft.com/beta/xyz.onmicrosoft.com/users/someUserId/userphotos/48X48
https://graph.microsoft.com/beta/xyz.onmicrosoft.com/users/someUserId/userphoto/$value
The error is occuring in the sandbox too (although I can't be sure the user in the sandbox does have a photo to begin with).
Is there any known workaround or fix for this issue?

There have been some updates in the API:
http://dev.office.com/blogs/Update-3-on-Office-365-unified-API
to get to the photo, please use /photo instead of /userPhoto

From this question:
The endpoint is now called "photo" and not "userphoto"
To get the photo information you use:
api/beta/Me/photo
To get the photo you call
api/beta/Me/photo/$value
I haven't been able to get photos for a given size (eg beta/Me/photo/48x48) to work

Related

Graph Delta API for groups returning 400 "Resource not found for the segment 'contacts'."

I develop an integration with Azure Ad which supports incremental synchronisations of users and groups.
It worked fine for quite a long time, but recently some (not all) of my customers started encountering one specific error.
For a request like:
GET https://graph.microsoft.com/v1.0/groups/delta?$skiptoken=<TOKEN_FROM_PREVIOUS_SYNCRHONISATION>
The API returns a response with status code 400 and body:
"error": {
"code": "BadRequest",
"message": "Resource not found for the segment 'contacts'.",
"innerError": {
"request-id": "<SOME-REQUEST-ID>",
"date": "2019-02-27T20:01:16"
}
}
I want to point out that this error occurs for some specific customers and I was not able to reproduce it on my environment.
Could someone give me a hint or two what could be causing this error?
Make sure you are using skip tokens and delta tokens correctly.
You should only have a skip token when you get the next page of a delta response.
Later when you want to get changes, you have to use a delta token.
So $deltaToken instead of $skipToken.
Like the delta link here: https://learn.microsoft.com/en-us/graph/delta-query-events?view=graph-rest-1.0#sample-third-and-final-response
I have the exact same problem when I send a request to the following endpoint
GET https://graph.microsoft.com/v1.0/groups/delta?$select=id,displayName,description&$expand=members
However, it works if I remove the "$expand=members" parameter from the URI. Could that be what's causing it in your case too?
After couple of days, my customers stopped raising the issue, so I believe the problem was temporary and on Azure side.

Instagram Hashtag Search API returns error message "user_id is required" although I have provided it

I am trying to get data about media from my IG Business account with a specific hashtag.
I used Graph API Explorer and tried with
/{hashtag_id}?user_id={instagram_business_id}&fields=recent_media
but I got an error "(#100) The parameter user_id is required."
Does anybody know what may be the problem and how to solve it?
The API URL is incorrect, your URL should look like this:
/{hashtag_id}/recent_media?user_id={instagram_business_id}&fields=id,caption,media_url...

/sites/root/sites request returns 404 error "The Resource Cannot Be Found"

If I use the GET statement:
https://graph.microsoft.com/beta/sites/root/sites/ then it correctly returns a list of sub sites under my main SharePoint site. But if I add a new Team Site sub-site to my main site and then run the same command it now returns
{
"error": {
"code": "itemNotFound",
"message": "The resource could not be found.",
"innerError": {
"request-id": "604af4de-b2b5-48cf-802b-1952a7d10b42",
"date": "2017-10-07T16:56:48"
}
}
}
When I delete the new sub-site the GET statement works again. I thought it was an issue with my SharePoint site so I reported it to Office 365 SharePoint support. They get the same error. It happens with Graph v1.0 and beta but is not in the Known Issues list.
I am trying to use this to get the Drive Id of a SharePoint library on a sub-sub site but cannot get past this issue on the problem sub-site. Is there any other way of getting a Drive Id of libraries on the sub-site that Graph at present seems unable to access?
Whilst the issue of Graph not being able to return a list of more than 7 sub-sites is still there, I have found a work around to enable me to get the Drive Ids of the Drives on the sub-sites. By using the /sites: /{sitepath} option (NB the colon) I was able to go directly to the required sub-sites and then get the relevant drive Ids.
I just wanted to follow up and say we have now made some improvements that should hopefully let these kinds of queries work past 7 subsites. So hopefully this issue is now resolved.
Workaround (v1.0 only) : use
https://graph.microsoft.com/v1.0/sites?search=*
as proposed here

Fetching a public page's posts doesn't work while it works in other pages

For a project, I need to get some public pages' posts.
I have 105 pages I need to get posts from and my program works fine with the most of them, but not with one.
When I use my app's access token it gets me what I want, except when trying to get posts from one page, "Yaakov.Perry".
When I send a request to this page, the server sends me this error:
"error": {
"message": "Unsupported get request. Object with ID 'Yaakov.Perry' does not exist, cannot be loaded due to missing permissions, or does not support this operation. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api",
"type": "GraphMethodException",
"code": 100,
Also, while my app's access token works for every page except this, the access code that the graph api explorer generates works for every one (including it).
Does any one know why this problem happens and how to fix it?

Instagram "this user does not exist" error in live mode

I'm getting the following error when hitting the get recent media endpoint of instagram:
"error_type": "APINotFoundError",
"code": 400,
"error_message": "this user does not exist"
Points to note:
1) App is in live mode, the basic permission has been approved. I didnt apply for any other permission.
2) Works fine for sandbox user
This is the exact URL i'm hitting:
https://api.instagram.com/v1/users/2147483647/media/recent/?access_token=
Am I missing something or do I have to explicitly do something to put the app into live mode ?
It probably means that the user id 2147483647 does not correspond to a valid Instagram user. I just tried on my end and I get the same response.
P.S: You should NEVER post your access_token in public posts such as these. You should mask it from the post ASAP.

Resources