Question:

I want to get the data for the current user's friends. I am currently using a for-loop so that for each of the friends, a call on the Graph API is made. Is there a better to do this?

 

 

Answer:

Appreciate if you can like this page if you find it useful! - Click "Like"

The Graph API supports "selection" and requesting multiple objects in a single query using the "ids" query parameter. Below is how Facebook explains the issue:

By default, most object properties are returned when you make a query. You can choose the fields (or connections) you want returned with the "fields" query parameter. For example, this URL will only return the id, name, and picture of Ben: https://graph.facebook.com/bgolub?fields=id,name,picture

You can also request multiple objects in a single query using the "ids" query parameter. For example, the URL https://graph.facebook.com?ids=arjun,vernal returns both profiles in the same response.

http://developers.facebook.com/docs/api#selection

 

 

Find my FAQ on Facebook Development useful? Download the PDF for all the FAQs HERE!