Reputation: 3277
I have for example a fan page url (http://www.facebook.com/Microsoft).
I want to get via this url, data about the page - I mean name, likes, pic.. (What I can get from the table page
).
I thought to do something like that:
SELECT name FROM page WHERE page_id IN (SELECT page_id FROM ?? WHERE url = http://www.facebook.com/Microsoft)
But I dont know where I can get a page_id by url.. any suggestions?
I have to use FQL
Upvotes: 1
Views: 3756
Reputation: 30002
To get the ID from url's, use the object_url
table:
SELECT id FROM object_url WHERE url = "http://www.facebook.com/Microsoft"
returns
[
{
"id": 20528438720
}
]
Once you have that, you can use it to query the page using the ID.
SELECT name,pic,fan_count FROM page WHERE page_id = "20528438720"
returns
[
{
"name": "Microsoft",
"pic": "http://profile.ak.fbcdn.net/hprofile-ak-snc4/195730_20528438720_693767_s.jpg",
"fan_count": 702319
}
]
If you only want to query url's which are under Facebook, i.e. profiles, then use the profile table instead and get rid of the url, and use the username instead:
SELECT id,name,url,pic FROM profile WHERE username = "Intel"
[
{
"id": 22707976849,
"name": "Intel",
"url": "http://www.facebook.com/Intel",
"pic": "http://profile.ak.fbcdn.net/hprofile-ak-snc4/203507_22707976849_6594669_s.jpg"
}
]
Upvotes: 3