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&
Related
Hello I am new at facebook graph API
when I used url like this
https://graph.facebook.com/v2.7/me?fields=id,website,about,first_name,last_name,gender,birthday,education,age_range,email,%20television,movies,hometown,context,devices,favorite_teams,work&access_token=EAAM...
I can get website, first name , gender etc of me
but when I try to get another user's information from this url
https://graph.facebook.com/v2.7/{user id}?fields=id,website,about,first_name,last_name,gender,birthday,education,age_range,email,%20television,movies,hometown,context,devices,favorite_teams,work&access_token=EAAM...
I can get null values expect first_name, last_name and id
How can I correct the mistake?
Note : the other user allows to show this info.
Thanks
1)I want to fetch the venues for the nearby location by passing the latitude and longitude of to the API in foursquare.
I got this url:-thisand i got peroper response.
But for this latitude and longitude:- 32.3456,141.4346
(url)
I did not get any data.
Same for Facebook.I use this :- facebook API
But i want the list of generalized category listing from this API.And this API only gives me data of hotels only.Because i pass q=hotel.
2)How to get oauth_token for foursquare?
Please help me.
The reason you did not get any data for that location is because there are no venues in that area. If you follow this link you will see that location is in a remote area of Australia.
For help with connecting users to Foursquare, you can use these instructions
Need to post status update and attach user location by passing latitude and longitude. In FB docs they say, we need to pass "place" FB entity that is:
"an object containing id and name of Page associated with this location, and a location field containing geographic information such as latitude, longitude, country, and other fields (fields will vary based on geography and availability of information)"
How to create/get such place name from latitude and longitude? I'v read related post1 and post2 but was not able to find a working solution.
How to create/get such place name from latitude and longitude?
There is currently no API available for developers to create Facebook pages or places. However, you can get place name by doing a FQL query like this...
'SELECT page_id,name,latitude,longitude FROM place WHERE distance(latitude, longitude, "LAT_HERE", "LON_HERE") < 250`
250 refers to the radius(m) that it will search within, it can go up to 50000.
Doing this FQL query will return you the Facebook Place Page's id, place name, latitude and longitude.
(Actually there is no need to get the place name as the page_id is what you really need. With page_id, you will be able to get all the information of that Facebook Place Page.)
Need to post status update and attach user location by passing
latitude and longitude.
Assuming you are actually trying to publish a checkin, you can refer to the references below to proceed further with the data you have obtained from the FQL query...
A normal status update(feed dialog) is different from a status update with location tagged to it(checkins), they are using different APIs.
References:
How to get place_id before checkin?
Facebook - Publish Checkins using PHP SDK/JavaScript SDK
Facebook Documentations
Page FQL - http://developers.facebook.com/docs/reference/fql/page/
Checkins API - http://developers.facebook.com/docs/reference/api/user/#checkins
If you have the lat/long data, you can search for the place and get the place-id which can be included in the POST message.
Please check these related posts -
https://developers.facebook.com/docs/opengraph/actions/#taggingplaces
https://developers.facebook.com/blog/post/2012/03/07/building-better-stories-with-location-and-friends/
I need to get the living city of each person in a group. Including people that are not my friends.
In the browser seeing facebook profile of some unknown person, they show "lives in ...", if this is set as public information. They include the link to the city object with the city id in the link. That's all that I need.
But, using a facebook app that I created to use the facebook graph api, this information is not public. I can only get the user propriety 'location' from friends of my that I have permission to see it. I gave ALL the possible permissions to my app.
In the api explorer, when I use it as REST, they show few informations about someone not friend of mine.
https://developers.facebook.com/tools/explorer/
Also in the api explorer, when I use the FQL, it didn't works.
This query works, returning the JSON with the data:
SELECT uid, name FROM user WHERE username='...';
But this other query doesn't work:
SELECT uid, name, location FROM user WHERE username='...';
They return a json with a error code:
{
"error": {
"message": "(#602) location is not a member of the user table.",
"type": "OAuthException",
"code": 602
}
}
I asked for ALL the permissions options in the token. And I can get this info in the browser version of the facebook. But how can I get it with the API ?
The location field only exists in the Graph API table. Since you are using FQL, here are the location fields available to you:
current_address: the current address of the user,
current_location: the user's current location,
hometown_location: the user's hometown (and state).
Permissions:
user_location or friends_location permissions to view: current_location,
user_hometown or friends_hometown permissions to view: hometown_location.
Source: https://developers.facebook.com/docs/reference/fql/user/
I am using Facebook Graph API to search facebook POST with location parameter. I am using the below code.
string url = string.Format("https://graph.facebook.com/search?q={0}&type=post&limit=10&location=Newark,NJ,US", txtSearch.Text);
WebClient web = new WebClient();
string xml = web.DownloadString(url);
The above code works fine witout any error, but it doesnt look like it is considereing location parameter.
Is it possible to add any location paramter to the search query fetching Facebook Post?
location parameter can be in form of actual location string (e.g. Los Angeles, CA,US) or GeoCode value ?
Facebook does not support location por "post" search using API
You can't do it for post but you can search a place by location with a geocode:
https://graph.facebook.com/search?q=coffee&type=place¢er=37.76,-122.427&distance=1000&access_token=...