I am trying this in the graph explorer with my account: https://developers.facebook.com/tools/explorer/?method=GET&path=me
I added to the token all the possibly related permissions.
It shows me many info but any location. On my Facebook profile I don't have a hometown but I have the current location, and my friends can see it too. It says I live in *. I couldn't find any privacy settings where I could have set not to show it to any app.
Thanks!
It was a bit tricky, till I found that hometown and location are stored as single-dimensional array in response data. Try the code below:
FB.api('/me', function(response) {
console.log(response.hometown.name);
console.log(response.location.name);
});
This should work.
User location seems to be missing in the https://graph.facebook.com/me since a while. Not sure is there anyway around it to get the location. So, I hope that clears up. FB is weird.
Make sure on the permission and you can check location with this.
https://developers.facebook.com/tools/explorer/?method=GET&path=me%3Flocation
Related
i`d like to get the number of persons that where reached by my post.
I have tried /{post_id}/insights/page_impressions and anything else listed on the Facebook API-Documentation.
Facebook API
but i only get a emty data array and nothing else.
It seems like a lot of people don't get this number, is there any solution?
Check the permissions you've requested with the token and make sure that read_insights is included. Here's a screenshot from the API explorer:
I used to be able to go to my Facebook profile page https://www.facebook.com/{Username} and replace the "www" for "graph" https://graph.facebook.com/{Username}.
The answer to that used to be my real facebook ID and some other info, but now I get:
{
"error": {
"message": "(#803) Cannot query users by their username ({Username})",
"type": "OAuthException",
"code": 803
}
}
Yesterday I made the exact same thing and it worked, but today it doesn't. Is there any other way of finding my ID? Does it work for anyone?
For finding any facebook group_id or page_id or user_id go to inspect element of page and find these in meta tags.
Group Id
fb://group/Here_is_your_group_id
Profile user_id
fb://profile/here_is_your_user_id
Page Id
fb://page/here_is_your_page_id
graph.facebook.com/{Username} is not available now but lookup-id.com still can find your facebook ID
There are already 3 exact same questions in the last 2 hours. Please use the search function of StackOverflow before posting a question!
You cannot get the username field anymore. This is very well documented in the Facebook docs.
See
graph.facebook.com/username does not work
If you only have your user ID, the simplest way would be to use an online service (like this one: http://getuserid.com) and paste your Facebook username.
If you need the user ID by programming, this is different. You could in this case parse the HTML code of the page (CTRL + U will show you the HTML code of the page) and search for the term entity_id, which is the user ID. You could then use regex to extract the information.
There is no way to get your Facebook ID via the Graph API!
You can use a regular expression to find your Facebook ID. If you paste the source of a profile page (or page/group) inside http://regexr.com/3gi7q it will match the Facebook ID for you.
It is using the following regex to find the Facebook ID:
/fb:\/\/profile\/(\d+)|fb:\/\/page\/\?id=(\d+)|fb:\/\/group\/\?id=(\d+)/;
You can also use the tool i created and just fill in your profile url: https://commentpicker.com/find-facebook-id.php
Go to your Facebook profile and right click on your cover photo, if you copy the URL it should have your Facebook id in it like so. fbid is what you want. I don't there's any AIP for it anymore. Looks like Facebook may be finally phasing it out.
https://www.facebook.com/photo.php?fbid=1512641059003115&set=a.1376251679308721.1073741827.100007717054203&type=1
You can use the sources already identified or you can right click below the navigation bar and view page source. Use your CTRL+F (find) and search for [profile_owner"].
The number listed shortly thereafter will be your global ID. It will generally look like this:
[profile_owner":"10000320024513431"].
The # is listed multiple times (like 75) in the data and follows terms such as ["profile_id"], ["uid":], and [?profileid=] to name a few.
I always us this tool https://www.graphsearcher.com/ to find my personal facebook ID. Hope can help you.
Head over to here and authenticate with it, you can then use the Graph explorer to get your ID. You'll also need an access token to view the https://graph.facebook.com/{ID} page.
I just tested this for you and it works correct.
I can see FB source and above i can see my FB ID also.
I used https://graph.facebook.com/username and tested with firefox.
Maybe your using it wrong per accident?
It seems like code 803 means no valid username.
Are you really sure you are using a correct username?
You can also try below link to find your FB ID.
http://findmyfacebookid.com/
Good luck mate!
I am trying to do something that seems really simple when you take a look to the graph API doc on facebook developper web site : get the photos that have been posted on an event wall !
However everytime I try to do this request (a GET request on //photos) the only thing I get is an empty "data" array. And yes I have the permissions that are asked by Facebook...
Is it a part of the API that is not working ? (Please if there is guy from Facebook around here...) or is it me ?
I'm not sure why /event-id/photos didn't worked (yet mentioned in the docs); but there's a way (full-proof)-
<event-id>/feed?fields=picture
You'll get an array in result; for each object if picture object is available or not.
I think this is the only solution, since if you open your event nowhere you can find the thing such as "event photos". The photos published by the users on an event are just a feed, there's no album(s) created.
Hope it helps. Good luck!
I am trying to get a listing of photo albums using:
https://graph.facebook.com/USER_ID/albums
It is working perfectly for some users, and other users I am getting nothing:
{
"data": [
]
}
I am sure in both cases the user ID is correct and valid. For the users that return nothing I can see the albums when logged in as the same user, so I don't see how permissions could be an issue.
Any suggestions would be greatly appreciated!
Igy appears to be correct. This is a duplicate of 10939051.
Since I could not find it, the setting that will exclude all user photos and albums from apps can be found by going to Privacy Settings > Apps, Games and Websites > How people bring your info to the apps they use > De-check My photos.
Here is a screen shot:
You'll get better results by writing it this way:
https://graph.facebook.com/USER_ID?fields=albums.fields(id)
I got this result while playing with the Graph API Explorer.
Here,
you've to generate a new token with user_photos and friends_photos selected.
Then, select what you need in the list:
And it seems to display what you need (at least if the ID you are looking for is the one of your friends)!
So really what i would like to do is access my page's photos albums to include them into my own website. So i can upload to facebook and have that viewable on my own site.
I using the php skd but fql would be better for this as i can easily get a JSON object back and i believe i wouldn't need to use the sdk as this is for user's informtaion not a pages details.
So does anybody have ideas on this?
url i'm trying to access the query:
https://api.facebook.com/method/fql.query?query=SELECT%20name%20FROM%20album%20Where%20aid=%27118818791532414%27&format=JSON
Page i am taking the photos from:
www.facebook.com/mayfieldathleticfc
Album i am using as an example:
http://www.facebook.com/media/set/?set=a.118818791532414.24873.118816378199322
I thought maybe i hadn't set the photos to public but after closer inspection i don't believe you can do this?
Anyway thoughts are welcome =)
That URL returns to you an informative error message:
{"error_code":102,"error_msg":"Session key invalid or no longer valid",
"request_args":[{"key":"method","value":"fql.query"},
{"key":"query","value":"SELECT name FROM album Where aid='118818791532414'"},
{"key":"format","value":"JSON"}]}
To call Facebook APIs, you have to pass in a session key - even to access 'public' things. A good starting point for learning how to authenticate and get a session key is http://developers.facebook.com/docs/authentication/
After a little more routing around i realised that it was my id's and owners details that was not correct: api.facebook.com/method/… i had this sorted it worked.