Object and Basic APIs

Certify and Increase Opportunity.
Be
Govt. Certified Facebook Apps Developer

App-owned objects and user-owned objects

With the Object API you can create two kinds of objects:

  1. An app-owned object. These objects are used across your entire app. They are public, just like self-hosted objects. Anyone who uses your app can see them and they can be attached to any story your app creates.
  2. A user-owned object. A user-owned object is owned by a user. The privacy setting on a user-owned object can be changed so its only visible to a subset of a person’s audience. Stories created with a user-owned object are specific to the person attached to it.

Creating app-owned objects

In order to create an app-owned object you make a call to a URL that includes the type of object you want to create along with a JSON-encoded version of the object attached. For example, if you want to create an app-owned that is a common book object you can make this call:

curl \
  -X POST \
  "https://graph.facebook.com/app/objects/books.book"  \
  -F "access_token=$APP_TOKEN" \
  -F "object={
    \"title\":\"The Hunt for Red October\",
    \"image\":\"http://ecx.images-amazon.com/images/I/314leP6WviL._SL500_AA300_.jpg\",
    \"url\":\"https://link.you.want.displayed/example/hunt-for-red-october-link\",
    \"description\":\"Classic cold war technothriller\",
    \"data\": {
      \"isbn\":\"425240339\"
    }
  }

Including your Object Meta Tags

To make a page into an object, you have to include the Open Graph meta tags in the <head> of your page – they contain the values of the properties that each object type contains. Here are some sample meta tags for a Recipe object from our example cookbook app:

<meta property="fb:app_id"          content="1234567890" /> 
<meta property="og:type"            content="social-cookbook:recipe" /> 
<meta property="og:url"             content="http://samples.ogp.me/136756249803614" /> 
<meta property="og:title"           content="Chocolate Pecan Pie" /> 
<meta property="og:image"           content="https://fbcdn-dragon-a.akamaihd.net/hphotos-ak-prn1/851565_496755187057665_544240989_n.jpg" /> 
<meta property="cookbook:author"    content="http://samples.ogp.me/390580850990722" />
 
Facebook APIs
Real Time APIs

Get industry recognized certification – Contact us

keyboard_arrow_up
Open chat
Need help?
Hello 👋
Can we help you?