Before version 2.1 i was using fql to get user public information using the following code.
"https://graph.facebook.com/fql?q=select uid,name,current_location from user where uid = xxx"
Then i would parse the country, state and city from the response.
without fql we are using location field which leads to a page and the page gives longitude and latitude.
How do i get the country in v2.2 (The name or country code)
Thanks
You can easily get the location with Graph API using /user
refer to below link.
https://developers.facebook.com/docs/graph-api/reference/v2.2/user
https://developers.facebook.com/tools/explorer/145634995501895/?method=GET&path=me%3Ffields%3Dlocation&version=v2.2&
I already tried lot of topics and follow some groups ok we can get facebook group id, but just some group I cannot get group id it return blank data, I also add token id but it isn't work
$url = 'https://graph.facebook.com/search?q='.$groupname.'&type=group&access_token='.$session->getToken();
some group work fine but some group get nothing.
https://www.facebook.com/groups/Happypattaya/
This is one of group url that I cannot get id.
I really need to use graph or facebook sdk to get group id.
Thank you in advance for your help.
when you search facebook response group id and name. Or you can get group id or you can have it in http://lookup-id.com ( get open/close facebook group id )
How to get the general information listed on the home page?
Facebook makes a request to
https://www.facebook.com/ajax/pagelet/generic.php/LitestandMoreStoriesPagelet?
with params:
ajaxpipe
ajaxpipe_token
no_script_path
data
__user
__a 1
__dyn
__req
__rev
__adt
And although it returns a json (inside a script with conditions...) is not a clean answer.
Is there another way to get that data? I do not want to use the sdk.
If you want the 'News feed', you'll want to use the /user/home/ API endpoint:
https://developers.facebook.com/docs/graph-api/reference/v2.1/user/home
e.g. https://graph.facebook.com/me/home?access_token=VALID_ACCESS_TOKEN will just grab your own News Feed.
You can also filter by any of the 'filter_key' values returned from the FQL query (use the Graph API Explorer and API version 2.0):
SELECT filter_key, name, type, value FROM stream_filter WHERE uid = me()
e.g. adding the query string filter=app_2305272732 will return a feed of things from the 'Photos' app (i.e. photos added to Facebook by your friends)
I want to get all the comments made on facebook on a particular link.
see this image: http://cl.ly/062k1T380V1V3y2b1t0G, I want to get all 55 commments for that link. Is there any way I can do it?
I have tried graph.facebook.com/search?q=madhyamam.com, but the output is not accurate, or return null value.
You can get the url by querying all of the url's you have linked from your page:
https://api.facebook.com/method/fql.query?query=SELECT link_id, created_time, title, url FROM link WHERE owner = YOUR_FACEBOOK_PAGE_ID&access_token=YOUR_ACCESS_TOKEN
That should give you a list of your urls and their ids. With the id you should be able to get the comments to it:
https://graph.facebook.com/LINK_ID/comments
That will give you all of the info on your comments.
yoo can easily get mobile number of the user by this url https://graph.facebook.com/me?access_token=ACCESS_TOKEN......
the output comes in json format , after that you got the string , in there is value for key ..."mobile_phone"
Otherwise ,,,it is also beneficial for you https://graph.facebook.com/me?fields=address,mobile_phone&
access_token=ACCESS_TOKEN ...in this case you have to take permissions from the facebook api..
Thanks
Is there a way to get the ID of the picture that is the current profile picture for a user?
Edit: OK, seems there is no trivial way to get the ID!
However, it appears from random testing that every user has a single album with attribute type="profile", and the first image in this album is always the profile picture, so it is possible to get the ID of the profile picture that way. Can some more experienced with Facebook confirm that this is indeed always the case?
You can get the users public profile photo from the following url:
https://graph.facebook.com/[id]/picture
Reference:
http://developers.facebook.com/docs/reference/api/
The answer seems to be yes
e.g., the photos in an album have an ID (the profile photo is a different object though, which a different FB ID). An ID for every object is a core concept of FB's new graph API: Every object in the social graph has a unique ID.
Indeed, data request i have ever made through the FB Graph API returns (when successful) a response in the form of a JSON array, comprised of nested ID-Value pairs, e.g. the education field from a User object:
"education": [
{
"school": {
"id": "126533127390327",
"name": "Massachusetts Institute of Technology"
},
"year": {
"id": "140829239279495",
"name": "1992"
},
"concentration": [
{
"id": "192578844099494",
"name": "Computer Science"
}
],
"type": "College"
}
The profile photo is a connection of the User object (i.e., every FB object has Fields and Connections).
According to the table in the relevant FB Developer Page, a call to the Graph API requesting picture (user's profile photo(s)) returns a string which is the URL for the user's profile picture.
But why doesn't this same call return the user's profile photo ID?
The reason i suppose is that the URL returns:
Graph API : User Properties
The user's profile photo is not there, but in an adjacent node:
Graph API : User : Connections : picture
(See FB Documentation for Graph API structure here).
When you make that API call, examine the Request Headers, and in particular, the Request URL; when you do, you'll see something like this:
http://profile.ak.fbcdn.net/hprofile-ak-snc4/32093_100005743929541_5467982_q.jpg
The string between the underscores (100005743929541) is the user ID. this is easy to verify by making another call to the Graph API. From your browser location bar (assuming you are logged into Facebook) just enter:
https://graph.facebook.com/me
So again, the first item in that JSON string is the user's FB ID. Given that, it seems to me that if user profile ID does indeed have its own ID, then that string (user's FB ID) plus the two smaller adjacent strings of integers on either end of the ID, should be it--in other words, 32093_100005743929541_5467982 in the Request URL above.
Finally, perhaps the best way to answer this is by using the new Graph API Explorer. (I just tried to verify this, but my requests are hanging.)
There is one more simple way to accomplish this task.
Fetch all facebook albums by https://graph.facebook.com/me/albums?access_token=.
Loop into the albums and check if object type == 'profile'.
Get the value of object cover_photo where type == 'profile'.
This value of cover_photo is the id of profile pic of the user.
You can check it by https://graph.facebook.com/<cover_photo value>?access_tokne=
I don't know if you still need this but this is the way I did it in PHP:
$albumsfb = $facebook->api('/me/albums/?fields=type');
$albumsfb = $albumsfb['data'];
foreach ($albumsfb as $albumfb) {
if ($albumfb['type']=='profile'){
$albumprofile = $albumfb['id'];
break;
};
}
$photoprofilefb = $facebook->api('/'.$albumprofile.'/?fields=cover_photo');
$photoprofilefb = $photoprofilefb['cover_photo'];
$photoprofilefb = $facebook->api('/'.$photoprofilefb);
$fotoperfilfburl = $photoprofilefb['source'];
Instead of "me", put the user id that you want?
http://graph.facebook.com/<SOCIAL-ID>/picture?type=<small|normal|album|large|square>
SOCIAL-ID = Facebook returned social id.
small|normal|album|large|square = size of image.
I recently tried to like one of my friend's profile pictures from the Graph API explorer
Here's how I got the id of his current profile pic:
fields=friends..fields(albums.fields(photos.fields(id,name,link),name))
If you have used the Graph API explorer, you might be aware of the above line of code that's generated in the textEntry when you tick the checkboxes. The limit size is up to you, I just kept it 1 to receive the JSON object quickly (without the limit, it took me 5 minutes to get the JSON object containing a lot of information).
So here are the things you need to check in the Graph API (maintain the order):
Friends
Within Friends Albums
Within Albums Name and Photos (Within Photos the id and name of the photo)
I made a PHP script to like all the profile pictures of my friends :)