getting only the posts that have location data - facebook

I am trying to get the posts of a user only if those posts have location data. location is nested under place in user's `posts'. How do I write a graph api query that would get me all the posts of a user ONLY if those posts have location?
With this query, https://graph.facebook.com/v2.3/me?fields=id,name,posts.limit(25).until(1399832709).with(location){place}, I am getting what I want, but only a subset of the total. I know it's subset because it's only returning 2 posts with location data when I know there are at least 50 posts. So I thought if I removed limit(25).until(1399832709) from the query, it would now give me all posts that have location. But nope. I get absolutely nothing back.
Could anyone please advise on how I can structure the query correctly? If there are facebook engineers out there reading this, please help! Thank you very much.

I think the problem might be the {place} at the end. Have you tried
/me/posts?with=location&limit=50&until=1399832709&fields=id,place
Furthermore, as far as I know, if you remove the limit parameter, it will apply the standard limit, and not show all.

Related

Getting Facebook page posts of the last hour/day etc

Is it possible to specify a time span for the posts returned by GET /v2.x/{page-id}/feed?
For example, I want all the posts of the last hour and only those...
EDIT: Just found the since and until fields for the feed. However, this only seems to apply to posts, not to comments on those posts...
Any way to apply the time span to both posts and comments, regardless?
Ideally, I would get a chronological list of messages (whether posts or comments) for the last X time units.
Graph API returns comments in same order as selected on actual post|picture|etc..
I already searched alot about this. Then i went for a stupid but simple solution. I can show you if you are willing to made 2 requests to graph api to get comments

How to get all user's likes using facebook's graph API

How can I query facebook's graph API to retrieve all user's likes (not only pages but also photos and others)?
For instance, how could I get all the pictures a user has liked? Using facebook's search bar you can find them easily by clicking on "photos has liked".
I wrote a script that scrapes the page content and does that but it's not very efficient.
I have recently come accross a similar problem, maybe this helps you solve it.
https://graph.facebook.com/v2.5/{page_id}/feed?fields=likes.limit(1).summary(true)&since={start_date}&until={end_date}&access_token={access_token}
This will give you a list of all posts that received likes during the specified time period. If you manage to write a code summing up the following JSON path you got your sum for "all user's likes":
data[0].likes.summary.total_count
Not entirely sure is this is exactly what you were searching for, hope it helps you though - and if not you, someone else.
As for likes you can also use the same way to extract Shares and Comments:
Shares
https://graph.facebook.com/v2.5/{page_id}/feed?fields=shares&since={start_date}&until={end_date}&access_token=
Comments
https://graph.facebook.com/v2.5/{page_id}/feed?fields=comments.limit(1).summary(true)&since={start_date}&until={end_date}&access_token=
Best regards
There isn't to my knowledge any way to get this from the API without grabbing every type of response from the API and then sorting through for likes. Facebook search bar uses an internal API different from the Graph API.

How can the insights edge be used on the /<page_id>/posts URL with the Facebook Graph API

So I am trying to retrieve some insights information and noticed there was a connection within the posts field of a page. When I use this connection, it retrieves all of the insights information, all metrics. I only want to limit myself to a few that I need, instead of getting the overhead of searching it out myself after I pick it up.
This is the URL I have tried to limit myself to only the post_consumptions metric
https://graph.facebook.com/v2.0/<page_id>/posts?fields=insights{post_consumptions}
This doesn't work, it still returns every metric, so I thought maybe I can't choose the metric, but only the fields. Then I tried this:
https://graph.facebook.com/v2.0/<page_id>/posts?fields=insights{id, name}
But there were no changes in results, I can't seem to find any documentation about this connection either in the documentation of Facebook Graph API, which doesn't really surprise me as Facebook does this quite a lot.
The documentation about it, which I could find, are here:
https://developers.facebook.com/docs/graph-api/reference/v2.0/insights
https://developers.facebook.com/docs/graph-api/reference/v2.0/post#edges
I dont know if you still have this problem but i solved it like this
https://graph.facebook.com/v2.2/<page_id>/posts?fields=insights.metric(post_impressions_unique)

Get all Posts and Comments made by "me()"

i am trying to retrieve all posts and comments "me()" created. But I dont find any way to do this. There only seem to be a way to retrieve the posts on the "me()"'s wall - but no way to retrieve all posts created by "me()" on the walls of other users.
The obvious way would be to use the actor_id field in the streams table, but thats not indexed, so the query wont work.
Google didn't return a solution either - even through i expected this to be a common problem ?
I already know how to retrieve all statuses and likes but posts and comments seem to be unsolvable...
Any Ideas?
Thanks
https://graph.facebook.com/me/posts will return what you're looking for.
You need the read_stream permission to access this resource. (documentation)
You definitely want posts of type status and wall_post.
Currently, there doesn't seem to be a way to retrieve the same data over FQL.

facebook batch request to get all the photos

I want to get all the photos of the user who gave permission to the app. Currently, I tried single and batch request of Graph API but it always paginates the results. Is there a seamless way to get all the objects without following pages?
ps: I'm using PHP-SDK so answering in php is the money :)
I found out that giving limit=0 is solving the problem. It still generates paging object but they return empty data set. So, limit=0 returns the whole dataset in one shot.