Jazib
Jazib

Reputation: 1230

FQL query using Facebook Graph API

I have this query:

SELECT uid, name, current_location FROM user WHERE uid IN ( SELECT uid2 FROM friend WHERE uid1 = me() ) AND current_location.id IN (Select current_location.id from user where uid = me() )

It gives me results as required i-e friends only with a particular location. Can i get the same results using Graph API instead? assuming I have the location id. I tried this in graph API:

me/friends?location.id='111501225536407'&fields=location

Is something of ^ sort even possible using graph API?

Upvotes: 2

Views: 3669

Answers (2)

Alexander Nenkov
Alexander Nenkov

Reputation: 2910

you can execute fql queries (including multiqueries) through the graph api like this:

https://graph.facebook.com/fql?q={"albums":"select aid, name,cover_pid FROM album where owner=me()","album_covers":"select src from photo where pid in (select cover_pid from %23albums)"}&access_token=xxxxxx

It's a little tricky with the url encoding. Be sure that "#" sign used in multiqueries is encoded as %23

Upvotes: 1

cpilko
cpilko

Reputation: 11852

Not that I can see. The Graph API is best for getting all of or the most recent items of an object. If you wanted to filter those friends by location, you would need to do that on the client side.

If you want Facebook to pre-filter your results on their servers, you need to use FQL.

Upvotes: 1

Related Questions