Common Scenarios for using the Graph API

The Graph API is a powerful resource which can be used in a massive variety of ways. Our Reference docs provide the raw technical structure, fields, and operations available in the API, however we have also provided a list of common scenarios for apps below, to help you locate the reference doc that you need to build a solution for it.

Missing Something?

If you think we've missed a common scenario here, tell us using the feedback widget at the bottom of the page.

Are two people Facebook friends?

You can determine whether two people are friends on Facebook, without having to parse their entire list of friends.

Use These APIs

Publishing new Status Updates

Apps can create new status updates on behalf of people or Facebook Pages.

Read These Docs

Use These APIs

Uploading Photos, Videos and Creating Photo Albums

Apps are able to publish and create new photo albums, and publish photos or videos via the Graph API on behalf of people or Facebook Pages.

  • Photos can be uploaded by sending the actual image files, or by using URLs of images already on the internet.
  • Videos can be uploaded as part of a chunked, resumable upload. For more information, see Video Upload with Graph API.

Read These Docs

Use These APIs

Apps can share links to content on other websites on behalf of people or Facebook Pages.

Read These Docs

Use These APIs

Setting Privacy When Publishing

Most endpoints that let you post (e.g. posts, photos, notes) also allow you to include a privacy parameter that lets you control who can see the content.

The parameter determines the privacy settings of the post. If it is not supplied, it defaults to the privacy level granted to the app in the Login Dialog. This field cannot be used to set a more open privacy setting than the one granted during login.

What's passed to the privacy parameter is actually a JSON-encoded object. It contains the following fields:

Name Description Type

value

The value of the privacy setting.

enum{'EVERYONE', 'ALL_FRIENDS', 'FRIENDS_OF_FRIENDS', 'CUSTOM', 'SELF'}

allow

When value is CUSTOM, this is a comma-separated list of user IDs and friend list IDs that can see the post. This can also be ALL_FRIENDS or FRIENDS_OF_FRIENDS to include all members of those sets.

string|csv[string]

deny

When value is CUSTOM, this is a comma-separated list of user IDs and friend list IDs that cannot see the post.

string|csv[string]

Scheduling Posts for Pages

Facebook Page posts can be scheduled to go live at a particular time. The scheduled_publish_time parameter should be included when publishing a Page post, and it should be a UNIX timestamp that is between 10 minutes and 6 months from the time of publish. You can update this scheduled time by updating the post with a new scheduled_publish_time.

Read These Docs

Use These APIs

  • /{page-id}/feed to publish Page posts, using the scheduled_publish_time field and the published field with a value of false.

Backdating Content

It is also possible to back-date Page posts using the Graph API. This can involve updating an existing post with a new date, or creating it at publish time. Open Graph Actions published on behalf of people can also be back-dated.

Read These Docs

Use These APIs

Creating Content without Publishing

It is possible to add some content to the Graph without publishing a news feed or profile story indicating that it has been created. This is useful in a few situations, such as Page posts which are scheduled to go live at a particular time, or when a photo is to be used in a photo comment.

Use These APIs

Responding to Events

Apps can respond to events on behalf of people.

Use These APIs

Testing your App

Apps can create test users and use them to make API calls.

Use These APIs