Gervase
Gervase

Reputation: 1030

Post an Object to Facebook Graph API Explorer

Trying to figure out the correct Json string to pass to my OpenGraph app. I'm using the Gigya Java SDK, but decided to eliminate some of the extra layers in testing the string.

So I'm first of all looking at the Graph API Explorer.

My POST field name is "Recipe" and the value is

{"title":"one-handed fried pies","description":"ye olde Description goeth here.","image":"http://www.recipe.com/images/one-handed-fried-pies-R094255-ss.jpg","url":"http://www.recipe.com/one-handed-fried-pies/"}

This maps exactly to the fields of the Recipe object.

However, no matter how I format the JSON, I get this exception

{
  "error": {
"message": "(#3503) \"{\"title\":\"one-handed fried pies\",\"description\":\"ye olde Description goeth here.\",\"image\":\"http://www.recipe.com/images/one-handed-fried-pies-R094255-ss.jpg\",\"url\":\"http://www.recipe.com/one-handed-fried-pies/\"}\" is an invalid value for property \"recipe\" with type \"Reference\"", 
    "type": "OAuthException", 
    "code": 3503
  }

}

Any thoughts?

Upvotes: 1

Views: 2072

Answers (1)

Gervase
Gervase

Reputation: 1030

By hacking thru, got it to work this way.

  1. Most important... the URL as above must point to a page that has valid og: tags for the app. (You can look at the source of this page for the structure http://www.csmonitor.com/Science)

  2. In the Graph Api Explorer,Select your Application in the top left.

  3. Click get Access token.

  4. Select POST.

  5. Click on Add a field

  6. Type the name of the object. In my case "recipe".

  7. Type the url. In my case, I set up a live test page and deployed it.

  8. click submit and wait for an id. { "id": "290473937742173" }

Upvotes: 1

Related Questions