The Facebook Graph API allows developers to receive data, post data, or rearrange items on Facebook's web pages. The API categorizes Facebook pages into three areas:
Name | Description |
---|---|
Nodes | Nouns or objects. Often something that can be seen visually on a page |
Edges | The connections or linking between the nodes or objects |
Fields | Available data on the nodes |
Similar to other social media RESTful APIs, data for a specific page, or even node, can be requested through a web link. For example, place the address graph.facebook.com/comcast
into a web browser. A page with numerous return results should appear. Pictured below is the data received from the API call and actual Comcast Facebook page:
Notice some of the Graph API's results and compare them to the actual page:
- Listed on both is the number of likes, 352
- Listed on both is the company website
- From the API's results, Facebook has categorized Comcast as a company
##RESTful APIs Typically Have Four Actions
- GET: to recieve data from the source, already demonstrated with the Comcast Facebook page
- POST: sends completely new data
- PUT: updates existing data
- DELETE: deletes existing data on the source
- Stay away from the term "request" when describing any four of these actions
- GET is similar to the traditional "getter"
- POST and PUT are similar to the traditional term "setter"
Facebook's Graph API has SDKs for many CS languages. To start examing what a RESTful API call looks like, examine the JavaScript below:
var xhr = new XMLHttpRequest();
xhr.open("GET", "http://graph.facebook.com/comcast", false);
xhr.send();
console.log(xhr.status);
This article will be lengthened in the future. Hope you enjoyed the read so far.