My favorites | English | Sign in

Social Graph API (Labs)

Frequently Asked Questions

  1. Overview
    1. What is the Social Graph API?
    2. How does Google gather social graph data?
    3. Are you gathering my private data?
    4. Which websites are you indexing right now?
  2. API Technologies
    1. What is JSON?
    2. What is XFN?
    3. What is FOAF?
    4. Should I use XFN or FOAF?
  3. Managing Data
    1. I would like to have my site indexed. How can I accomplish this?
    2. How often does the crawler run?
    3. Can I use Sitemaps with the Social Graph API?
    4. How do I add a web page or connection?
    5. How do I remove a web page or connection?
  4. Querying
    1. How do I interact with the Social Graph API?
    2. What languages can I use to utilize this API?
    3. What are the caching policies behind capturing information returned by these calls?
    4. Are there any limits on querying the Social Graph API?

Overview

What is the Social Graph API?
The Social Graph API makes information about the public connections between people on the web more easily available. Developers can query this public information to offer their users dramatically streamlined "add friends" functionality and other useful features.
How does Google gather social graph data?

The Social Graph API returns data from an index of public web pages and publicly declared relationships between people on the web. An example of a public user account is your MySpace profile page. An example of a publicly declared relationship is a hyperlink pointing from your LiveJournal page to a friend's.

Our crawler scans for links that:
  • indicate that a set of web pages are related to a particular user
  • indicate public friend relationships around a public web page

We accomplish this by indexing open standards like XFN and FOAF, which annotate links to describe friend relationships.

Are you gathering my private data?
No. The API crawler simply scans for links that:
  • indicate that a set of web pages are related to a particular user
  • indicate public friend relationships around a public web page

We accomplish this by indexing open standards like XFN and FOAF, which are currently used by a number of sites to annotate links and describe friend relationships. All of the information in the API is already indexed by search engines and appears in search results.

Which websites are you indexing right now?
Sites that appear in the Google Web Search are automatically included in the Social Graph API if they contain XFN or FOAF data. Additionally, data is included from some other publicly declared profiles, such as MySpace.

API Technologies

What is JSON?
JSON stands for JavaScript Object Notation and is a way of describing complex data structures through text, making it ideal for passing data over the web. Data from the Social Graph API is returned in JSON format. For more information about JSON, please visit http://www.json.org .
What is XFN?
From the XFN website: "XFNTM (XHTML Friends Network) is a simple way to represent human relationships using hyperlinks." XFN treats hyperlinks like edges in a social graph. By adding additional information to the links on a website, you can describe relationships between people.
What is FOAF?
From the FOAF project website: "The Friend of a Friend (FOAF) project is creating a Web of machine-readable pages describing people, the links between them and the things they create and do." FOAF expresses social relationships in a RDF format, stored as a publicly readable file on your website.
Should I use XFN or FOAF?
Developers should choose the technology that suits their needs best. If you find it easier to annotate the links on your website, then XFN may be the best choice for you. Alternatively, if you would rather store information about your connections in one central file, then FOAF may be the way to go.

Managing Data

I would like to have my site indexed. How can I accomplish this?
First, use XFN or FOAF to annotate relationships about people on your site. When your site is crawled by the API crawler, this information will be made available through the Social Graph API. That's it!
How often does the crawler run?
The social data on your website is indexed when Google's web crawler accesses the pages on your site. Your pages will continue to be crawled at the same rate as they currently are for Google's search index.
Can I use Sitemaps with the Social Graph API?
Sitemaps can help direct Google's crawler to specific pages on your site. If you are hosting a FOAF file on your server, it can be helpful to include the location of this file in your Sitemap XML.
How do I add a web page or connection?
Connections, or edges in the Social Graph API, are represented through the FOAF or XFN data you include on your site. If you wish to add edges to your social graph, just modify this metadata to reflect the connection. Web pages, or nodes in the API, represent URLs specified as endpoints in the FOAF or XFN data. If you register a new profile page on MySpace, for example, simply update your existing social graph data to reflect the new node.
How do I remove a web page or connection?
To remove nodes or edges from the Social Graph API, clear any XFN or FOAF references to the items you wish to remove. Users can visit their individual accounts to change public/private settings, then the change will get picked up automatically. The Social Graph API will refresh its index periodically in the same way as the Search index refreshes.

You may also submit URLs for re-crawl by emailing socialgraph-request [at] google.com if you do not want to wait for the index to automatically refresh. Note that you will not be able to remove pages from Google's search results by emailing this address. To remove a page from a search result, please consult this page.

Querying

How do I interact with the Social Graph API?
You query the social graph API by making a HTTP request to a specially formatted URL. The response to such queries is encoded as JSON data. For more information about querying and retrieving Social Graph data, please consult the API documentation.
What languages can I use to utilize this API?
The Social Graph API is a REST based API that delivers data in a JSON format. You may use any language that is capable of requesting HTTP information over the internet and parsing JSON data. Most languages include libraries that help simplify these actions, including Java, Python, PHP, Ruby, C#, JavaScript and more.
What are the caching policies behind capturing information returned by these calls?
Please consult the terms of service for information about the policies for using this data.
Are there any limits on querying the Social Graph API?
Yes. Use of the Social Graph API is subject to a query limit of 50,000 queries per user per day. If you go over this 24-hour limit, the Social Graph API may stop working for you temporarily. If you continue to exceed this limit, your access to the Social Graph API may be blocked. Please contact us at socialgraph-request [at] google.com if you would like this limit raised for your application.