Query Facebook to collect info on all birthdays in an area - facebook

First time poster so please be gentle. I'm looking for a way to run a FQL query that will return all of the birthdays for a given geographical area. For example: Return all of the (publicly-shared or access-token available) birthdays for everybody that lives within 50 miles of Portland, OR.
I've dinked around with FQL with simple queries, but once I hit the multi-query stuff it gets messier. Facebook's developer page gives an example of running the query in PHP, but I just want to figure out the proper URI variables and do it by hand in a browser window.

I assume you're asking about the current / app user's friends?
If so you're probably better to just pull all friends' birthdays, and current locations, and where the friend has a location specified, do your own matching - the API won't let you query users by current location

Related

facebook likes that WE have done

We have several people working on our Facebook page, and I am trying to find out if there is a way to list all the companies that WE have liked - not the ones that like us.
I know that isn't possible to do (apart from analytic data). We are a chamber of commerce, and we were liking all our members who are on Facebook, hoping to be able to look back and find out how many are actually on Facebook.
Hope this makes sense, and I hope it is possible. :)
Sure just go to: https://developers.facebook.com/tools/explorer (you must be a registered facebook developer to acces this tool).
Then on the input where you have this:
your_fb_id?fields=id,name
change it to this
your_fb_id?fields=id,name,accounts and press send.
You'll get all the pages wich you're administrator, choose the one you want by clicking on the respective ID. Now you're querying the page you've chosen. Last step, on the input to make queries change it to this:
your_page_id?fields=likes
EDIT
The previous request only returned the number of total likes made by the page.
To get the likes made by the page on other pages you have to use FQL Query
Change from Graph API to FQL Query and paste this
SELECT page_id, name FROM page WHERE page_id IN (SELECT page_id FROM page_fan WHERE uid = your_PAGE_ID)
This is without doing any code, if you want to get the information and format it on your own way, you'll have to develop an app where you grant the permission manage_pages and user_likes(this one I don't think is mandatory though), use the graph api to get the likes and format the json returned data

Facebook Graph / Fql: Get all pics

I'm having return issues with graph API and I'm wondering if any knows why or how I can fix it.
I need to download all photo data for a given user (friend data, not the active user). Here are the two things I have tried.
FQL: "select pid from photo where subject=friend_uid"
Graph: "friend_uid/photos?fields=picture,created_time,tags.fields(name,id)&limit=1000"
I have friends_photos and user_photos permissions.
Any users with > 1000 tags will have drastically reduced result numbers.
For example, it will only return around 200 photos or so which is not acceptable, I need all of them
Chunking with since/until (or created_time < or > __) as well as limit clauses only improves the result count with FQL but the amount of chunking makes it VERY inefficient.
Any ideas? The tag data is also important for my purposes.
So, I need the proper query or sequence of queries to obtain ALL tag data for all photos of a given user_id using either FQL or graph-api.
I recently created a similar project (pulls all the photos from all your facebook friends in order) in PHP. Facebook's limits are poorly documented but I found that with the Graph API, it's 400 photos the friend is tagged in and 5000 photos the friend uploaded per request. Note that pulling from {user}/photos only pulled photos they are tagged in, while {user}/photos/uploaded only pulls photos that {user} uploaded. I figured that that 400 tagged and 5000 uploaded photos was enough for my situation.
If you do need additional photos, you will have to check the number of returned photos for the user for the /photos request and check if it's equal to 400. If so, you will have to go on to the next page, recursively.
For the /photos/uploaded request, Facebook uses cursor-based pagination (see bottom of this page), which means that pagination->next and pagination->prev data is only sent when there are more values to return. This makes it fairly easy to get the next page (once again you will have to do this recursively).

Fetch location or coordinates specfic posts using facebook search api

Is there are way to fetch location/coordinate specific public posts using the facebook search api (https://graph.facebook.com/search/?q=KEYWORD&type=post ...)? I want this to be a general search query, without any user authorization.
I tried using https://graph.facebook.com/search?type=location&center=37.76,-122.427&distance=1000&access_token=... , but this requires access_token and returns objects(not posts) posted only by friends of the user whose access token is used for querying.
I also tried https://graph.facebook.com/search?q=samsung&type=post&center=12.9833,77.5833&distance=1000&access_token=[I-USED-ANY-ACCESS-TOKEN], but I dont think this is giving me the location specific results as I am not receiving any loc info in the json response.
Are there any free data sources/APIs that can provide me location/coordinate/ip specific posts/data/tweets/feeds, etc from the web / social networking websites?
It is possible to walk the FB graph to get such places and their coordinates for types like event, place, checkin. For example:
Search (link):
https://developers.facebook.com/tools/explorer?method=GET&path=search%3Fq%3Dconference%26type%3Devent
Then pick one of the results and do (link):
https://developers.facebook.com/tools/explorer?method=GET&path=463944956965055
Then lookup the venue id's coordinates (link):
https://developers.facebook.com/tools/explorer?method=GET&path=199344279273
Check the FQL table definitions to verify that location coordinates are provided.
The accepted answer doesn't really answer the question.
The answer is no, there isn't a way to search for general posts by location (excluding your friends). It's probably to protect user privacy.

Getting more than 25 photos from the Facebook Graph API

I'm trying to retrieve all the photos a user is tagged in using the Graph API but I can only get the latest 25.
Is it possible to get more, and if so, how?
Have you tried adding a limit and offset parameters? Quoting the documentation:
Paging
When querying connections, there are several useful parameters that enable you to filter and page through connection data:
limit, offset: https://graph.facebook.com/me/likes?limit=3
until, since (a unix timestamp or any date accepted by strtotime): https://graph.facebook.com/search?until=yesterday&q=orange
Currently there is 100 items limitation per query both on photos and likes:
However, 100 pics query takes so much time to run for me.
The following API call:
https://graph.facebook.com/me/photos?limit=500
gives only 100 results with paging link.
Run in FQL explorer (If you have more than 100 pic on your account):
https://developers.facebook.com/tools/explorer/?method=GET&path=me%2Fphotos%3Flimit%3D500
Setting limit=0 may not always work in the case that a user has a huge number of tagged photos. Also note that the tagged photos graph API can return a large number of embedded comments as well, so especially if you are developing a mobile app, it can take a long time to return all the photo data. Finally I find that sometimes Facebook will limit the number of entries it can return in times of high load.
So... perhaps the best way is to use the "paging" "next" url that appears at the end of the returned photo data. This gives you the next graphAPI call that you can then use to get the next x photos. It does this by using and pre-populating the limit and until parameters and incorporating them within the graph api call. Very handy.

How to get category specific likes for a facebook user using graph API

I'm pretty new at this. I was playing with the Facebook Graph API and was able to pull all my LIKES using the call
$all_likes = json_decode(file_get_contents('https://graph.facebook.com/me/likes?access_token='.[access_token]));
Now when I display these, they have a field called category which has different values like TV Show, Book, Public Figure etc.
So my question is how do I get category specific likes - for instance I just want to fetch ALL the BOOKS that I LIKE
Obviously its possible to fetch all the likes and store them on the server side and work on it but the LIKES list is too huge for certain users and it doesn't make sense to pull everything if you just want to show a certain category.
I feel like I'm missing something.
If its not possible through the graph API call, then even a FQL solution is welcome.
Thanks for your time
R
You can use FQL, just like in this answer:
SELECT page_id FROM page_fan WHERE uid=me() AND type="MOVIE"