Understanding Facebook Graph API. how to request for information
Graph API is a very powerful restful API provided by Facebook which enables you to retrieve many different information from your users Facebook accounts based on the permissions that they Grant you. If I want to put it in very simple words, the graph API works as follow. you can call the graph from your Air app and tell the graph what information you need. if the information you are requesting is public on Facebook, you won’t need any access token. but if you are asking for personal information, you need to have logged in your users first and have a valid access token.
Our Facebook ANE gives you full access to the Graph API (you can set the graph version to connect to yourself. the default version is v2.3 which is the latest graph version when building this extension. but you are not limited to that and you can change that yourself.)
in this post, I will show you how to call on the Graph and how to retrieve the information from Facebook. but if you need to learn more about Graph, you should read the Facebook official docs here https://developers.facebook.com/docs/graph-api/reference
// when working with the FB ANE, you always need to initialize it with your fb app ID first
FB.getInstance("00000000000000"); // you need to call this only once when your app starts.
// add listeners to get the response from the Graph API
// then request for information. if you are logged in, the access token will be sent automatically.
FB.graph.call("https://graph.facebook.com/v2.9/me", URLRequestMethod.GET, new URLVariables("fields=name,email,picture&metadata=0"));