Facebook Graph API
Facebook Graph API is the way to write and read from facebook social graph.It’s the way,we can access /retrieve Facebook data.Facebook Graph API often releases the API versions incremental.Incremental releases to ensure that facebook data is protected.It also provide better user experience.
There are two types of API available in Graph API.
- Public API key
- Private API key
Public API key allows the user to retrieve information from the publicly available data.Private API key allows the user to get most of the information from the facebook App. We need to understand the importance of public and private access tokens .
When you connect with Facebook through Graph API,it takes you to Graph API Explorer.You have to login in Facebook to get the Access toke.
Select all the permissions required from the Graph API like following
Once,you get the necessary permissions from the access tokens ,you are allowed to read and write in Facebook Social Graph.
You can access the Graph API explorer and enter the following query for example:
The above code will get you the id and name of the facebook user.
Likewise,you can change the query and get different details age,gender,location etc(Provided you have enough permission in the app)
you can find detailed information on following link:Graph API reference API manual
Each of the object is clearly explained.For simplicity purpose,I will explain object called Post.This is mostly used to retrieve the data from facebook fanpages.
In Graph API Version 2.2,it was easy to retrieve all the feed/post data with single query like select * type. Example: “https://graph.facebook.com/v2.8/microsoftbi/posts” will fetch all the feed/post column,which were 27 in total.
In Facebook API Version 2.9/2.11,facebook doesn’t allow the column to be explicitly visible.we need to query all the columns like below in V2.11.Though its additional effort for developer,for facebook pages -It’s additional layer of protection
The above query will expose listed column above.Please keep in mind that ,you have to explicitly mention all the columns in the Graph API explorer!