I'm building a django app and I'm interested if there is a way to get all the newest/popular events from facebook.
I want to get their title, location, description etc.
EDIT:
For the solution in the answer bellow to be successful i'll need the access token. It can't be done with the app token. Also I don't need to search through events but retrieve them sorted by popularity.
Since i'm using django facebook for now i can get my users friends events (in which they are participating). Is there another way to retrieve them through the API?
https://developers.facebook.com/docs/reference/api/
Look for the headline "Searching":
https://graph.facebook.com/search?q=conference&type=event
You need an access token for it, but i guess an app access token will do:
$app_access_token = APPID . '|' . APPSECRET;
The app access token is valid as long as you donĀ“t change the id and secret of the app (will most likely never happen).
EDIT:
If you take a look at the FQL table of the events, there is no field for the "popularity":
https://developers.facebook.com/docs/reference/fql/event/
...so i guess you mean sorting by "most attending people". But you wrote "all the newest/popular events from facebook", so that means all events and not only those of the logged in user and his friends. The only way to get the events in that case is the solution i presented above.
If you want to get the Events of the user, FQL would be the correct way, i guess:
SELECT name,description,location,attending_count from event WHERE eid in (SELECT eid FROM event_member WHERE uid = me()) ORDER BY attending_count DESC
This gives you all events of the user, sorted by the number of attending people.
Related
I have an existing app that uses the Facebook API & login that makes posts to the user's wall. For each post I store the id of that post.
What I need to accomplish is to gather like counts of those posts generated by the first app. I'm trying to write a small app that routinely pulls the like count. I've figured out how to get the like count of the post if I use a User Token - via Facebook Login. But since this app will run as a batch and not by a human, I don't want to use a Facebook login page. I could write code that simulates a user logging in but that would be a major ugly hack. I've tried to use an App Token but then the like count is always zero. I've found how to get the like count of a page without the need for a User Token http://www.techrecite.com/get-facebook-likes-count-of-a-page-using-graph-api/ but not a post
Is this even possible? If so how?
I've looked into Facebook API's subscription, but it doesn't seem possible to subscribe to a "like-a-post" event. Although I could be wrong. If so, could someone point me in the correct direction.
Thanks.
I am creating an iPhone email client that displays sender's profile pictures in in the UITableViewCells in the inbox, much like Sparrow does. I am using the following FQL query to grab these images:
SELECT
pic_big
FROM
user
WHERE
uid IN (SELECT uid2 FROM friend WHERE uid1 = me())
AND
strpos(lower(name),'INSERT_FIRST_THREE_LETTERS_OF_FIRST_NAME_HERE') >= 0
AND
strpos(lower(name),'INSERT_LAST_NAME_HERE') >= 0
ORDER BY name
I get the names of the senders from the email headers, and then search the user's Facebook friends using the full last name and the first three letters of the first name to account for nicknames. This works pretty well on the whole.
Sparrow, however, is able to grab profile pictures from Facebook for users I am not even friends with. How is this possible? I though queries were limited to specific groups, like your friends. And that searches for email addresses were not valid? Is this correct? How does Sparrow grab these profile pics?
Well as long as you know the users Facebook ID - it's a long number but treat it as a string. You can use this url to get their profile picture:
https://graph.facebook.com/[id]/picture
No need for anything more complex.
You can get the user_id of any known user from their email by making an API call to:
/search?type=user&q=USER#EMAIL.NET
If their email is registered with Facebook and public, you'll get back a JSON object with their name and user id. You'll need to make a separate call (or use a batch request) to get their picture from their ID.
Is there a workaround for the current bug in FQL: http://developers.facebook.com/bugs/266794040030851?browse=search_4f2ff35cf1e521b94883666
The idea would be to request SELECT id FROM user WHERE name="First last" but there is currently a bug in the index such that you can't search by name.
I need to find someones facebook id from their full-name, preferably ordered by mutual friends. I've tried the facebook search api but haven't found it reliable.
Thanks!
Actually there is an ugly workaround but you have to go outside FQL:
https://graph.facebook.com/search?fields=id,name,link&q=|name|&type=user&access_token=MY_VALID_ACCESS_TOKEN
Using search API this might work, where there is |name| you should just put "Name Surname".
EDIT:
Beware: A facebook app cannot have MORE privileges than a facebook user, ok I'm expanding what I'm trying to say: As you know a facebook user can modify his account settings in order to be NOT visible in public search that means EVERY search will not display that particular user... if the user you are trying to search has this particular setting, then you won't see him, not even through FQL!
This is where a facebook user can set this
I have worked earlier on facebook API. I successfully used it and fetched all friend lists with their email ids. I was also able to get user email id who logged in through facebook API.
Now in gap of 7-8 months I found that faceAPI development section has been changed . New one is something different.
And now I am facing problem to get email id after user login at facebook.Yet all other details are coming like user name .user id and location except email id.
Old script is also not working with me. Could you help me to get email id of user who get login by facebook at my website.
Thanks for your cooperation.
No one will do your homework (upgrade the code for you)
Read the most current documentation
Accessing users e-mails require a special permission email
Users may choose not sharing their direct e-mail with you
You didn't say what technology you are using, but you can check the PHP-SDK example page to get started.
Direct Access Method:
Log into Facebook under your name. If you need an "Access Token", Click on the Extended Permissions and click the "read_friendlist" check box to get your Access Token and then
submit your query. You may need to "Allow" access, so just follow the prompts given.
Voila! You now have the usernames for everyone on your Friends List. The "username" parameter in the query will give you the contact email "message to that person" and you append #facebook.com and send them a message. Very simple.
http://developers.facebook.com/tools/explorer?fql=SELECT%20username%20FROM%20user%20WHERE%20uid%20IN%20%28SELECT%20uid2%20FROM%20friend%20WHERE%20uid1%20%3D%20me%28%29%29%20ORDER%20BY%20name
I had been using the import function in Yahoo Mail but now it has been limited to the first 50 names on your friends list. Where I work, they have over 6,000 friends between the two pages. This is a very simple solution to my problem. And now I can write a very small PHP sendmail program and send EVERYONE on the friends list an email message that goes directly to their messages. No more viewing page sources or manually doing this.
I can create a special email list on IFanz that will handle all dups, even if I repeat this process on a monthly basis to acquire new emails.
-SAB
I request latest photos for a user using an FQL query, like the one below:
SELECT pid, aid, owner, src_small, src_big, src, link, caption, created FROM photo WHERE aid IN (SELECT aid FROM album WHERE owner IN (SELECT uid2 FROM friend WHERE uid1=) ORDER BY modified_major DESC LIMIT 300) ORDER BY created DESC LIMIT 500
It works well but I believe it doesn't respect the setting where the user block specific users on the facebook page. So in my app, he sees all the photos, and he's not happy :).
Now, I see that in user table there's is_blocked property, but it's not indexed so I can't use it in a WHERE clause. I also don't want to call FB for every user I get just to check for that property and filter based on that in the app itself.
So, first of all, am I correct that this query doesn't respect blocked users settings?
If yes, is there a way to respect this setting using FQL?
You may look at privacy table. There is id column which represent an image object as well and deny field with a list of users that cannot see the object. I think you should use a fql.multi-query to resolve this. Some info about fql.multi-query you can find at this topic.