Querying stream table with multiple source id throws exception - facebook-fql

I am using FQL query to get update for list of source ids.
select type,post_id, message,permalink, created_time,updated_time,type,message_tags, app_data, attachment from stream where source_id IN (page_id1,page_id2)
I have used my app access token, also I have added read_stream permission in extended permissions.
I got following error.
{
"error": {
"message": "(#606) Queries for multiple source_ids require a non-zero viewer that has granted read_stream permission",
"type": "OAuthException",
"code": 606
}
}
My app has 10 users.I have check insights of my app,it show Monthly Active Users :10.
Am I missing anything.

Related

Unsupported get request public information for a user on FB

We are try to update users information in our db related to their interests available on facebook. We are able to import data of almost everyone register with us but for the user with fb profile id 100012374975360 we are unable to do so we getting the following error even with fb graph api explorer with the following query params
100012374975360?fields=id,age_range,first_name,last_name,birthday,gender,email,education,devices,cover,about,hometown,currency,context,languages,is_verified,link,locale,location,name,middle_name,meeting_for,name_format,quotes,favorite_athletes,political,security_settings,timezone,sports,relationship_status,work,third_party_id,religion,likes.limit(10),tagged.include_hidden(true).limit(10),interested_in,photos.limit(10)
Error:
{
"error": {
"message": "Unsupported get request. Object with ID '100012374975360' 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,
"fbtrace_id": "FK9+dItscZj"
}
}
Can know why it is happening, what is wrong with this user.
Thanks

Facebook Ads creative object returns story_id that throws a GraphMethodException 100 error

I am building a data warehouse that pulls data from both the OG Insights and Ads API.
Issue:
I am querying the creative object in the Ads API which returns the story_id field for type 27 ads. For most story_ids that are returned I am able to do a OG query for the story_id and have a valid response returned. However, for some story_ids I get GraphMethodException.
Creative query:
https://graph.facebook.com/6003446971120?access_token=TOKEN
The token has been exchanged with user who created the ad and has advertiser role on the page which the story_id was posted to (based on the object_id of the creative). The token has the following scope: ads_management email manage_pages offline_access read_insights
Creative query returns:
{
"url_tags": "",
"story_id": "123 - example",
"type": 27,
"object_id": "456 - example",
"name": "REMOVED",
"run_status": REMOVED,
"preview_url": "REMOVED",
"count_current_adgroups": REMOVED,
"id": "REMOVED",
"creative_id": "REMOVED"
}
Query for story_id:
https://graph.facebook.com/123?token=TOKEN
I have tried 2 tokens, the first the the same as above, and the second is for a user that has the read_insights role on the project and has the following scope: ads_management manage_pages read_insights
Story_id query returns:
{
"error": {
"message": "Unsupported get request.",
"type": "GraphMethodException",
"code": 100
}
}
It looks there have been many posts on the GraphMethodException error. The common issue is that the token is from a person that is restricted from seeing the content (page age wall, targeted post, ect). However, I think I should have full access to the page based on my privileges. I tried to validate this by having the page manager do the same query, which also returned the GraphMethodException error.
So the net net is - How can I have an creative referring to a story_id which I cannot get a valid response for?
Thanks guys,
Aaron
PS - I also tried querying 456_123 (the pageid_postid format a post) and I still get the same result.
This exception does not necessarily relate to access permissions but can also mean that the object cannot be accessed.
For example, it is possible that a creative references a story which has been deleted. In this case, you will not be able to read the details of the story from the Graph API and this exception will be thrown.
You should check whether the story does exist or not by reading the graph for the page that this story was created under.

Why is this FQL call failing?

When I do a FQL query like the following (where <userId> is the Facebook ID of my FB friend):
SELECT type, post_id, created_time, updated_time, source_id, message, description, attachment FROM stream WHERE filter_key in (SELECT filter_key FROM stream_filter WHERE uid = <userId> AND type = 'newsfeed') AND is_hidden = 0 LIMIT 250
I'm getting the following error:
"error": {
"message": "(#606) uid in the where clause must be the session user",
"type": "OAuthException",
"code": 606
}
This seems wrong to me, because the examples in the stream_filter docs clearly use this example.
If the only way to get a stream_filter is by calling WHERE uid=me() then what is the point of the WHERE clause at all?
Is this a permissions issue with my access token?
If you are doing an FQL query based on the uid of your friend, you need to be authorized. Once authorized, you can add the access token granted by the user (in this case, your friend) to your query and have permission to get the results you're querying for.
This is because you're trying to fetch data, which in this case being their news feed comprised of posts created by their friends and pages they follow, that belongs to the user, which essentially belongs to them. You need to authorized to be able to access their data or act on their behalf to post photos and such.
However, if you're trying to get their own stream of posts that they themselves generate, you can totally get those, assuming that they are public and accessible by their set permissions. You can use a Graph API call:
https://graph.facebook.com/<userId>/feed?access_token=<your access token>
I'll also throw this in: You can read your own news feed as well with a Graph API call:
https://graph.facebook.com/me/home?access_token=<your access token>
You just need to make sure you have the 'read_stream' permission. If you try to get the news feed of another user by replacing 'me' with the user id, you'll get an error from Facebook:
{
"error": {
"message": "You can only access the \"home\" connection for the current user.",
"type": "GraphMethodException",
"code": 100
}
}
This further confirms that you can't access another user's news feed unless you have their permission, ie. being granted an access token that belongs to them.

Consult mailbox_folder Error (FQL)

I need to consult direct messages from a fan page, run the following FQL
https://graph.facebook.com/fql?q=select folder_id from mailbox_folder where viewer_id = <my fanpage id>&access_token=<My page access token>
but the request return the next error:
{
"error": {
"message": "(#606) You can only fetch messages for one user",
"type": "OAuthException",
"code": 606
}
}
How to fix it ?
Use the conversations endpoint in the Graph API
/PAGE_ID/conversations
https://developers.facebook.com/docs/reference/api/page/#conversations
I don't think there is an FQL equivalent for pages yet.

How to get a user's friend list from graph api without authentication?

I can see a user's friend list in facebook.com but I can't get this by graph api. I use this fql in "Graph API Explorer" :
SELECT uid1 FROM friend WHERE uid2=100002756991450
but it tell me:
{
"error": {
"message": "Error validating access token: Session has expired at unix time 1358668800. The current unix time is 1358677687.",
"type": "OAuthException",
"code": 190,
"error_subcode": 463
}
}
How can I get a user's friend list without authentication?
This is Not due to authentication, this is because user's session has been expired, So generate new access token and use it.
You could get this error.
{
"error": {
"message": "Can't lookup all friends of 515977793 due to user's privacy settings.",
"type": "NoIndexFunctionException",
"code": 604
}
}
if user has a privacy.