According to the officlal Facebook document, it seems that Facebook Graph API can treat Facebook Group profile pictures. However, the picture link provided at Connections section on the document doesn't return the proper image. The URL redirects to /images/icons/group-types/large/default.png, which is apparently a path for default profile picture, but it actually returns JSON that has data like this:
{
"error": {
"message": "Unknown path components: /icons/group-types/large/default.png",
"type": "OAuthException",
"code": 2500
}
}
Is this a bug of Facebook? Are there any ideas to avoid this?
Thanks in advance!
Looks like a bug, to workaround it, get the image as a String instead of a HTTP redirect:
https://graph.facebook.com/195466193802264?fields=picture
The Response is:
"picture": "/images/icons/group-types/large/default.png"
parse that, and if you get back a relative URL, prepend it with http://www.facebok.com
In this specific case, it works: Link here
In the meantime, you should File a bug report and get this updated in the API
Related
Context:
I have a facebook page with a post
I want to hide that post from anyone accessing the page (other than me) using the Facebook API
This can be achieved using the privacy field with "SELF"
Problem: Before I can even use it in my application, I cannot get a working example in the Graph API Explorer. I am using:
POST /v2.7/POST_ID?privacy={"value":"SELF"}
This works with other properties such as message, but despite many attempts, when I am able to actually set the privacy value property I always get the following message:
{
"error": {
"message": "(#100) Failed to edit object",
"type": "OAuthException",
"code": 100,
"fbtrace_id": "DkL5f4bzK2E"
}
}
Question: Can anyone provide a working example?
References:
Graph Explorer: https://developers.facebook.com/tools/explorer
Privacy Parameter: https://developers.facebook.com/docs/graph-api/common-scenarios#privacy-param
After asking Facebook Support Team if it was a bug, it is not, their answer:
You cannot edit the privacy of a post on a page . You can choose to
publish / unpublish it , if needed.
To change the audience of the page itself, you will need to edit the
settings of the page.
This is by design.
You can also see their answer directly: https://developers.facebook.com/bugs/152272141874454
Facebook's Graph API documentation lists the application object's ios_bundle_id field under the "Updating" section. However, sending a POST request to update said field, e.g.
POST: https://graph.facebook.com/v2.3/{application_id}?ios_bundle_id=["com.Company.AppName"]&access_token={app_access_token}
Responds with this error message:
{
"error": {
"message": "(#100) ios_bundle_id cannot be edited using the API. Please use the Developer App to edit settings instead.",
"type": "OAuthException",
"code": 100
}
}
I am able to update this field through the Developer App page, but in my case, I need to update this field programmatically.
I have successfully tested that same POST request to update other fields, e.g. app_name, so I am certain the request is structured properly.
Has anyone encountered this issue, or similar? Any suggestions are appreciated.
This is a documentation error. This field is not editable via the Graph API. You have to go into your Facebook Application Dashboard and change it from there.
Here's a link to the bug report created to fix this:
https://developers.facebook.com/bugs/1646835812217089/
I have a project where I have to search Facebook for all people at a
certain location and then apply further filters to the data. My problem and question is:
How do I get the initial data, using Graph API?
I know that it is possible, using the search field in Facebook itself. Just typing "All people living in ???" returns a list of people.
I couldn't find such functionality in the Graph-API of Facebook. Here is what I tried:
I modified some parameters of the standard search request
search?type=user¢er=52.946758,-1.172882&distance=1000
search?type=user¢er=Nottingham&distance=1000
and here is what I got:
{
"error": {
"message": "No node specified",
"type": "GraphMethodException",
"code": 100
}
}
Using a similar query with location instead of center
search?type=user&location=Nottingham&distance=1000
search?type=user&location=52.946758,-1.172882&distance=1000
search?type=user&q=&location=Nottingham
and only got a confusing error that the location I wrote is wrong
{
"error": {
"message": "(#160) Invalid coordinates. Coordinates must contain at least latitude and longitude.",
"type": "OAuthException",
"code": 160
}
}
Then searching for a user with the coordinates as query parameter returned an empty result.
search?type=user&q=52.946758,-1.172882&distance=1000
{"data": []}
Then I tried to search for a correct location to pass to the location parameter of the query
search?type=location&q=52.946758,-1.172882
and I only got a deprecation error
{
"error": {
"message": "(#12) location search is deprecated for versions v2.0 and higher",
"type": "OAuthException",
"code": 12
}
}
I don't know how to get to this. If someone could tell me, how to get this information, it would help
me a lot, since I don't know what to try next.
I have found this question similar to my problem, but the accepted answer isn't really answering the question
Facebook Search API - List all users based on location?
You can either search for a location OR search for a user, but you can definitely not search for "all users in an area". The Graph search on Facebook can handle a lot more things that you will never be able to get with the API. Think about privacy, i would not want any app to know if i am nearby, without even authorizing the App ;)
Facebook docs: https://developers.facebook.com/docs/graph-api/using-graph-api/v2.2#search
For getting the locatoin where the user is living, you need to check out the user reference: https://developers.facebook.com/docs/graph-api/reference/v2.2/user
There is a "location" field in there, you need to authorize a user with the "user_location" permission to get that information. It is not possible to get that information from any user. Just because you can see data on Facebook and it is public does not mean you can access it with an App, for privacy reasons this is only possible by authorizing the user.
Scraping without an App is not allowed btw, check out the scraping terms: https://www.facebook.com/apps/site_scraping_tos_terms.php
I tried this -> "firstname lastname location" and it works perfect.
For example -> "Sameeksha kumari australia"
The query looks like this
https://graph.facebook.com/v2.5/search?fields=id,name,picture.type(normal),location&limit=500&q=sameeksha kumari melbourne&type=user&access_token=token
I'm trying to get user's own posts on with images on his feed.
GET https://graph.facebook.com/USER_ID/photos/uploaded
will get me the uploaded images but without the status they were posted on.
on the other hand,
GET https://graph.facebook.com/USER_ID/feed?fields=message
will work just fine , but
GET https://graph.facebook.com/USER_ID/feed?fields=message,attachments
is returning me this
{
"error": {
"type": "http",
"message": "unknown error",
"status": 500
}
}
(FYI as for v2.1 FQL is deprecated)
help?
To my knowledge, you have to do USER_ID/feed and then filter out the posts that aren't images. In those kinds of objects, there is no attachment field. There isn't any way of filtering content in Graph API like you could do in FQL. You would have to get the post type which I'm pretty sure is the field type.
I want to get the views of a video on my Facebook page.
My request:
{object-id}/insights/post_video_views_organic
But instead of data I get the following error back:
{
"error": {
"message": "(#100) Tried accessing nonexisting field (insights) on node type (Video)",
"type": "OAuthException",
"code": 100
}
}
I havenĀ“t really worked with the Facebook API in the past so I cant really translate this error message.
(I am using the Graph API Explorer)
Try adding the id of your facebook page (which you can retrieve through the Graph API or here) to the start of the object id, followed by an underscore ('_') then the object id of the video.
Instead of "{object-id}/insights/post_video_views_organic".
Use "{post-id}/insights/post_video_views_organic" . You will get the metrics.
The "post-id" is post id of that video post.