
上QQ阅读APP看书,第一时间看更新
Summary
We learned a lot in this chapter about the Graph API: not just what it is, but also how to access it in AS3.
Key things to learn:
- The Graph API is so-called because it represents all of Facebook's data connected in an enormous graph of objects and connections.
- The Graph API has two types of elements: Graph Objects and Graph Lists.
- Graph Objects may have two IDs: a numeric one specified by Facebook, and possibly an alphanumeric one, specified by the Graph Object's owner.
- Graph Objects have connections; connections lead to Graph Lists; Graph Lists contain Graph Objects.
- The format of a Graph URL for retrieving a Graph Object is https://graph.facebook.com/graph_object_id.
- The format of a Graph URL for retrieving a Graph List is https://graph.facebook.com/graph_object_id/connection_id.
- Graph URLs return data in JSON format. This is a text-based format which uses key-value pairs to represent objects containing properties, arrays, and other objects.
- Sometimes, Graph URLs return error messages; these are also given in JSON format.
- We can use the
?metadata=1
parameter in a Graph URL to make it return extra information about the element, like the list of connections leading from a Graph Object. - Metadata is not returned for Graph Objects that are part of a Graph List.
- The JSON representation of a Graph Object can be deserialized to an AS3 object we can use in code using the as3corelib library.
We also discussed how the Graph API is so flexible, because it uses the same basic structure for every type of object in Facebook's database.
But what about those objects that give us an authorization error when we try to get information on them? That's what we'll cover in the next chapter.