Do you know a way to retrieve the posts of a group given a query as you can see in the image below?-> Query Search example
This example returns us a list of posts related to our query, but we're trying to do that through any API.
So far we've tried this using Graph API getting the feed of the group, but feed doesn't support filtering by a query. Below you can see the type of GET request we're working with.
graph.get('our_group_id?fields=feed.limit(500).fields(message, likes, type, comments.fields(like_count,message))'
We've also tried using SEARCH, though Search is not able to deal with groups, so we can't retrieve the posts of a group based on a query, but some public posts. Finally we've tried also with FQL, but it doesn't appear to support query terms when searching posts of a group.
Thanks.
Related
I'm now querying a post's insights with
/$postId/insights/post_impressions,post_impressions_unique
but if I want to have the insights of multiple posts, is there a way to achieve that with a single api call?
I've found that you can query the insights of multiple posts with a GET request like
/insights/post_impressions,post_impressions_unique?<id1>,<id2>,<id3>...
however you can reach the url length limit for GET requests, if someone knows a POST version that works it would be better
I am doing some proof-of-concept with Facebook SDK and Graph API to list user's posts using the /me/feed. I am unable to find a reference where I can see the list of possible options that can be passed as parameters.
For example, how can one find only those posts that are made within a specific time range? or how to retrieve only public posts shared by the user>
Could someone please help me by listing all the possible filters?
For getting data in a specific time range, take a look at time based cursors: https://developers.facebook.com/docs/graph-api/using-graph-api/v2.6#paging
/me/posts would be the endpoint to get posts shared by the user only. It´s explained in the links you posted.
How to query Graph API page-id/feed so it returns information about if every returned post is liked by access token owner?
One query is requirement.
There is no single API call for this, you would need to go through every like in the result to check if the User ID is in there.
Keep in mind that you would need to use paging in order to get all likes though: https://developers.facebook.com/docs/graph-api/using-graph-api/v2.2#paging
...So that would be a LOT of calls, unfortunately. Depending on the number of likes.
Okay, total noob question:
I want to understand what FQL can do, so I know if it can be useful to me before I try to learn it. From browsing Facebook's documentation I could not understand the following:
With FQL, can I search among ALL registered users for e.g. users of a certain age and gender from a certain region? Or can I only search among my friends?
Please provide a quote from and a link to official or otherwise reliable documentation along with your "yes" or "no".
Thank you!
The Facebook API only returns things that are visible to the owner of the access_token when making a query. FQL has the added requirement that the first field in your WHERE portion of the query must be indexable. These are marked with a ★ in the documentation.
For your example of querying the user table, your query must have one of the following immediately after WHERE: uid IN, username IN, name IN or third_party_id IN. The easiest way to get a list of these is by passing a subquery to get the current user's friends via WHERE uid IN (SELECT uid2 FROM friend WHERE uid1=me()). There are some other, more complex ways to get at a list of ids.
As for your app, it's going to be very hard to search for this reliably. The user's age, gender and location are up to the user to populate. The user can choose not to populate these, or keep them private. If these items are private, keep in mind that this filtering takes place after your query completes, so it is possible that all results returned by your query will be filtered out.
Using Facebook's Graph API, I am currently looping through all friends to retrieve their videos, and then present a list of these videos to the user. It obviusly takes a while to do this depending on number of friends,
Is there any way to just say to FQL - give me all videos that I have permsission to view?
Facebook doesn't want applications to be able to "mine data". They don't want applications to be able to collect that much data on anything they want. In most cases an ID must be specified.
User ID
Page ID
Group ID
Event ID
etc...
Even in such a case there is also limitations and multiple calls will have to be made. The limitations themselves are not only limited to accessing data with FQL or the Graph API.
There are also limitations on your access to the API. This is called application throttling and it can be enforced on your application if they find you doing an abnormally large amount of calls to the API. There are also other limitations such as making multiple sequential posts or even duplicate posts to your users.
I'm afraid that the answer is no.
Just playing around with the graph API explorer:
http://developers.facebook.com/tools/explorer?method=GET&path=fql%3Fq%3DSELECT%20vid%2C%20owner%2C%20title%2C%20src%20FROM%20video%20WHERE%20owner%3Dme%28%29
I know that to get a list of my friends I can do:
SELECT uid2 FROM friend WHERE uid1=me()
I then updated the video query to:
http://developers.facebook.com/tools/explorer?method=GET&path=fql%3Fq%3DSELECT%20vid%2C%20owner%2C%20title%2C%20src%20FROM%20video%20WHERE%20owner%20IN%20%28SELECT%20uid2%20FROM%20friend%20WHERE%20uid1%3Dme%28%29%29
And now I get a paginated list of all videos belonging to my friends. This one query is certainly better than pounding the API to death with multiple calls. :)