requestWithGraphAPI Method

This method makes calls to the new Graph Facebook API

intel.xdk.facebook.requestWithGraphAPI(path, method, parameters);

Description:

This method is used to make a request from the newer Facebook Graph API. For more information on this particular API, see Facebook’s documentation here.

Platforms:

Parameters:

  • path: The Facebook Graph PATH to execute
  • method: The request method to call the Facebook Graph API, typically GET or POST
  • parameters: Any parameters required for the request

Events:

  • intel.xdk.facebook.request.response: This event is fired upon completion of a Facebook API request.

Example:


var facebookUserID = "me";  //me = the user currently logged into Facebook
document.addEventListener("intel.xdk.facebook.request.response",function(e) {
        console.log("Facebook User Friends Data Returned");
        if (e.success == true) {
                var data = e.data.data;
                var outHTML = "";

                for (var r=0; r< data.length; r++) {
                outHTML += "<img src='http://graph.facebook.com/" + data[r]["id"] + "/picture' info='" + data[r]["name"] + "' />";
                        
                }
                document.getElementsByTagName("body")[0].innerHTML = outHTML;
                document.removeEventListener("intel.xdk.facebook.request.response");
        } 
},false);
intel.xdk.facebook.requestWithGraphAPI(facebookUserID + "/friends","GET","");                             
                                  
Reportez-vous à notre Notice d'optimisation pour plus d'informations sur les choix et l'optimisation des performances dans les produits logiciels Intel.