- Facebook Graph API Development with Flash
- Michael James Williams
- 476字
- 2021-03-27 00:41:52
Time for action - loading a Page
Browse to http://www.facebook.com/PacktPub to load Packt Publishing's Facebook Page. You'll see a list of recent wall posts, an Info tab, some photo albums (mostly containing book covers), a profile picture, and a list of fans and links.

That's how website users view the information. How will our code "see" it? Take a look at how the Graph API represents Packt Publishing's Page by pointing your web browser at https://graph.facebook.com/PacktPub. This is called a Graph URL—note that it's the same URL as the Page itself, but with a secure https
connection, and using the graph
sub domain, rather thanwww.
What you'll see is as follows:
{ "id": "204603129458", "name": "Packt Publishing", "picture": "http://profile.ak.fbcdn.net/hprofile-ak-snc4/ hs302.ash1/23274_204603129458_7460_s.jpg", "link": "http://www.facebook.com/PacktPub", "category": "Products_other", "username": "PacktPub", "company_overview": "Packt is a modern, IT focused book publisher, specializing in producing cutting-edge books for communities of developers, administrators, and newbies alike.\n\nPackt published its first book, Mastering phpMyAdmin for MySQL Management in April 2004.", "fan_count": 412 }
What just happened?
You just fetched the Graph API's representation of the Packt Publishing Page in your browser.
The Graph API is designed to be easy to pick up—practically self-documenting—and you can see that it's a success in that respect. It's pretty clear that the previous data is a list of fields and their values.
The one field that's perhaps not clear is id
; this number is what Facebook uses internally to refer to the Page. This means Pages can have two IDs: the numeric one assigned automatically by Facebook, and an alphanumeric one chosen by the Page's owner. The two IDs are equivalent: if you browse to https://graph.facebook.com/204603129458, you'll see exactly the same data as if you browse to https://graph.facebook.com/PacktPub.
Have a go hero - exploring other objects
Of course, the Packt Publishing Page is not the only Page you can explore with the Graph API in your browser. Find some other Pages through the Facebook website in your browser, then, using the https://graph.facebook.com/id format, take a look at their Graph API representations. Do they have more information, or less?
Next, move on to other types of Facebook objects: personal profiles, events, groups. For personal profiles, the id
may be alphanumeric (if the person has signed up for a custom Facebook Username at http://www.facebook.com/username/), but in general the id
will be numeric, and auto-assigned by Facebook when the user signed up.
For certain types of objects (like photo albums), the value of id
will not be obvious from the URL within the Facebook website; we'll look at how to find these later in the chapter.
In some cases, you'll get an error message, like:
{ "error": { "type": "OAuthAccessTokenException", "message": "An access token is required to request this resource." } }
Again, we'll look at what this means and how to get around it later in the book.
- 突破平面Photoshop UI界面設(shè)計(jì)與制作剖析
- VR新未來(lái)
- Excel商務(wù)數(shù)據(jù)分析與應(yīng)用(慕課版)
- 擁抱開源(第2版)
- UI 設(shè)計(jì)入門一本就夠
- Software Testing using Visual Studio 2010
- 中文版AutoCAD基礎(chǔ)培訓(xùn)教程
- Adobe創(chuàng)意大學(xué)After Effects產(chǎn)品專家認(rèn)證標(biāo)準(zhǔn)教材(CS6修訂版)
- Procreate+ SketchUp +Photoshop建筑設(shè)計(jì)手繪表現(xiàn)技法
- 專業(yè)級(jí)音樂(lè)制作理論與實(shí)踐Pro Tools:從入門到應(yīng)用
- Flash基礎(chǔ)與實(shí)戰(zhàn)教程
- Origin 2022科學(xué)繪圖與數(shù)據(jù)分析
- 中文版3ds Max 2014-VRay效果圖制作完全自學(xué)教程
- 用Studio One輕松制作你的短視頻音樂(lè)
- Python氣象應(yīng)用編程