How to retrieve user's Lived places, Trips and Life Events from Facebook Graph API? - facebook

Users can add "Lived places", "Trips" and "Life Events" on a Map on the new Timeline.
As you can get user's checkins via Graph API, I was wondering if it's possible to retrieve those locations as well?

According to the Facebook's Graph API Explorer and documentation this is not currently implemented as a GET possibility in the Graph API.
However, with the appropriate access token, you can retrieve certain aspects of a profile that include a Location ID that can be used to find the Location on Facebook, which you can then retrieve the Address, City, State, Coordinates, etc.
So, all around, the answer is no, at this time, you cannot retrieve Map information with Graph API. Hopefully, Facebook will make this available in the future.
ETA: I just just reviewed the Facebook OAuth Scope List and did some trial and error with the Graph API Explorer. I discovered the following...
While there is a permission scope for "user_location_posts" that must be included in the access token in order to get the location posts (i.e. statuses with a "Place" section) to show up in the feed/posts return from the appropriate GET call, there is no way to only retrieve the posts defined as "user_location_posts." In order to retrieve posts at all, you must first have the "read_stream" or "export_stream" permission which returns everything, not just the location posts.
You're going to need permissions to get the rest of the profile to find the locations on their photos, videos, and any other components that could potentially have a location attached.
There is a strong possibility that there is a Facebook component called "locations". Currently, it returns the GET error "(#100) Subject must be a part of the whitelist" rather than the typical error of "component does not exist". Therefore, it's possible that it's there and that the public does not have access to it at this time. It's also possible that this is just a bug I found.

Related

How to get my own Facebook user timeline using Graph API?

I would like to get all the posts and updates that are normally displayed in FB official application for MY account (this includes updates from my friends and liked pages).
I wasn't able to find any details how to get that, the only thing I've managed to get is my own posts.
Anyone got any experience with that using current Graph API verion (3.3)?
All the alternate FB clients (ex. Friendly) must be doing this somehow.
There is no way to get ANY data of users who did not authorized your App. Which means, there is no way to get posts of friends. You can only get your own friends, with the user_posts permission and the /me/posts endpoint. If some Apps access friend data without their authorization, they are most likely doing something that is not allowed.
Here is what I found in their API docs:
There are two scopes:
The user feed requires the user's permission
The public feed has fewer capabilities but doesn't require perms

How to retrieve the public information by using Facebook API?

I have a question about how to retrieve a specific person's information that is set to public by Facebook API (ex: email, location)? My idea is, (the app) to get the information that is set to public without asking the permission from the user.
I understand the Facebook Graph API could help us to retrieve the public_profile (graph.facebook.com/me), but that is very few and limited in v2.0+ (only id,name,first_name,last_name,link,gender,locale,timezone,updated_time,verified).
I also understand we can use scope in the fb:login-button (in the app) to get the user's permission to access the information. But in that case, since the user has granted it, therefore, even the information is set to private but the app can still access it, which is Not what I need.
In Graph API v1.0, we can use the API call (https://graph.facebook.com/me) to get the basic_info, which includes the information that is set to public. Since the v1.0 has already expired, therefore, I just wonder how I can get the public information by Graph API v2.0+, even other than the Graph API is fine.
Thanks.
As mentioned by #CBroe, it's not possible to retrieve such data without the user's permissions. Moreover, the info you are looking for has always been locked behind a permission even on v1.0: email and user_location
If you have a valid reason to ask for this info then explain it in your app and let the users decide.
Ref. https://developers.facebook.com/docs/facebook-login/permissions/v2.3

List of shares in FB graph api

I am trying to get a list of all users who share a given object on Facebook using the graph api.
There's been some useful info in this regard on stack exchange, here: Getting which users shared a post and here: List of people who shared on facebook
I experimented with the graph api's /{object-id}/sharedposts endpoint on the api. When I make the api call with a given object id which I have verified has been shared over 100 times (according to the /{page-id}/feed endopoint I am getting the object id from for said post), the api result invariably returns as such:
{
"data": [
]
}
So I am getting an empty array...is this because my access token will not allow me to get this information? I am not friends with any of the users sharing the post nor have I 'liked' the page in which the post originates from.
Just wondering if this is an authentication issue or if there's a different problem that I am running into. I've tried it with a few object IDs so I would like to ascertain exactly why there is no data when I use the /{object-id}/sharedposts endpoint.
Thanks!
There was a comment recently added to a response on the List of people who shared on Facebook post you referenced that solved this issue for me.
An access token with read_stream permissions is required, even if you have other permissions like read_insights. I was getting the same results as you until I added the read_stream permission.
However, you still may not get all or any of the shared posts. To see a share, it either has to be shared publicly or you must have permission to view that person's shared post.

Get Facebook user work

I'm trying to write some application that scan user's group posts. When I read the group feed posts using the API I’m interested to get some information on the one who posted this post ('from' field). The graph API today gives only the id and the name of this person. I'm interested also in his work place. I tried taking the user id and to access the / resource and to get his work field , but this field is not returned. When I’m looking on the same user profile in Facebook I see his work place is public, even I’m not connected with him.
Anything I can do to get this user work with the existing Facebook API?
Normally, if the work history info is not public, you'll need the "user_work_history" permission (see https://developers.facebook.com/docs/facebook-login/permissions#reference-extended-profile).
If it's public, you can try calling the
/{USER_ID}?fields=id,work

Is it possible to get all user id's who have shared a specific post, through graph api or any other resource?

I am looking for a way to record user id's of a public post for a brand. If there are any resources available, any help would be appreciated.
Retrieving share data with FB API doesn't seem to be officialy supported by Facebook, but you can retrieve posts shares with Graph API, just do the following:
Get the ID of your post (eg. /me/posts query)
Split the ID on underscore character and get the second part (first part indentifies posts author)
Query the shares: [id_2nd_part]/sharedposts
Note that since it's not officialy supported it may stop working at some point in the future
You can test it with Graph explorer - to get shared posts you need read_stream permissions on your access token if I'm not mistaken