Facebook Javascript SDK: Publish actions with custom Open Graph objects -


i'm working on cordova application more viral. therefore want include facebook , open graph api publish in news stream of playing users, when archive new things in game. i'm new whole fb , open-graph thing, please getting started it.

i login new user running following code:

$(login).on("click", function() {     fb.login(function() {         console.log("default login succeded");         console.log("asking write permissions");         fb.login(function(rsp) {             console.log("got write permissions");             log(rsp);         }, {             scope : 'publish_stream'         });     }, {scope:"email"});  }); 

i registered open graph action called buy under namespace einszwo. object use default object.

defined open graph action , object

it not yet reviewed, i'm using developer facebook account login on device.

now want call action. use following code:

    var obj = {         title : "i visited google",         url : "http://www.google.com"     };      function callback(response) {         console.log(json.stringify(response));     }       fb.api('me/einszwo:buy','post',obj, callback); 

unfortunately call fails following response facebook:

{"error":{"type":"exception",      "message":"the action you're trying publish invalid because not        specify reference objects. @ least 1 of following properties        must specified: object.","code":1611072}} 

it great if can me problem or provide information can further information.

thank you!

sebastian

edit

the solution paste url objects works, want use facebook hosted objects define in facebook object browser. approach able publish activity of user , if clicks on activity want them redirected our application information page.

we cannot provide page every different object. isn't there possibility use facebook javascript sdk use predefined objects hosted on facebook?

i have possibility either create new objects

   var o = {         "og:title" : "test " + new date(),         "og:url" : "http://facebook.com/appcenter/**appnamespace**",         "og:type" : "object"      }     fb.api('/me/**appnamespace**:buy', 'post', {         object : o     }, function(response) { console.log(json.stringify(response));}); 

this returns

{"message":"(#3503) \"{\"og:title\":\"test thu may 23 2013 12:19:45 gmt+0300 (eest)\",\"og:url\":\"http://facebook.com/appcenter/einszwo\",\"og:type\":\"object\"}\" invalid value property \"object\" type \"reference\"","type":"oauthexception","code":3503}

or way use id of predefined facebook objects like:

    fb.api('1234567890', 'post', {     }, function(response) { console.log(json.stringify(response));}); 

can me?

thanks!

it sounds talking app owned object.

an app-owned object. these objects used across entire app. public, self-hosted objects. uses app can see them , can attached story app creates.

you cannot use appcenter url object (this doesn't make sense if think open graph urls meant for, , pretty misuse of open graph)

you create object in curl or using object browser

leopluradon

in case created leopluradon object coffeeshop type. obtained id (149831668534005) result of creation , used in call

fb.api( '/me/philippeharewood:code', 'post', { coffeeshop: '149831668534005' }, function(response) {    if (!response || response.error) {       alert('error occured');       console.log(response.error);    } else {       alert('publish successful! action id: ' + response.id);    } }); 

a demo can found @ http://philippeharewood.com/facebook/charlie.html, wouldn't work gist.

result in browser

then can see in activity.

result on facebook

this explained in https://developers.facebook.com/docs/opengraph/using-object-api/


Comments

Popular posts from this blog

Change php variable from jquery value using ajax (same page) -

Pull out data related to my apps from Android Play Store and iOS App Store -

How can I fetch data from a web server in an android application? -