This article is out of date since 2018, sorry about that.
This is a example to show how easy to query data from public Facebook page by GraphAPI.
**I am going to take my favourite page, LadBible as the example, and intend to get the information below:**1. List of Posts of a page 2. Detail of single Post
To use GraphAPI, it is required to call with valid access token, to get valid access token, it is required to have APP_ID and APP_secret of a Facebook Application.
Go to the developer portal and follow the instruction, to create a APP which provide you APP_ID and APP_secret:
GraphAPI provides a handful way to get **access_token**
, by sending a HTTP GET request with parameters **_YOUR_APP_ID_**
and **_YOUR_SECRET:_**
GET https://graph.facebook.com/oauth/access_token?client_id={YOUR_APP_ID}&client_secret={YOUR_SECRET}
Paste it into browser:
Since we got the access_token by the response in Step2, which is used as parameter for any graphAPI request.
To get the Facebook Page’s feeds, we need to tell GraphAPI which the ID of the page, where we can find from the page URL:
Get the pageId of LadBible, assemble it into the URL below:
GET
Paste it into browser:
Below is the note where you can go deeper about GraphAPI. Things becomes so easy of what Facebook team built for the developers, making a public page crawler, or users behavior data analytic are just a matter of few click.
GraphAPI explorer is the API playground, I would say that it is the best API documenting and troubleshooting tool I have even used, there is simple user interface, RESTful URL design and immediate HTTP response result just within a click. I don’t even need to write a line of code, to ensure I am doing it right.
I use to test the API URL on explorer first, then assemble in to my code.
**GET** https://graph.facebook.com/v2.9/{POST_ID}/reactions?access_token={ACCESS_TOKEN}