Reputation: 30047
I am attempting to work out what is needed to publish a custom open graph action that includes user generated photos. I have made it through the approval process and am currently testing using the JSSDK. I have the following code which seems to work:
FB.api('/me/cheezburger-app:create', 'post', {
meme:'http://cheezburger.com/6459677184'
}, function(response){
console.log(response);
});
My understanding is, to publish this as user generated photo all I need to do is include an image property containing an array of objects like this:
FB.api('/me/cheezburger-app:create', 'post', {
meme:'http://cheezburger.com/6509097984',
image:[{user_generated:true, url:'https://i.chzbgr.com/completestore/12/8/13/c9Smb0ba2EGTLepkCgEp2g2.jpg'}]
}, function(response){
console.log(response);
});
Sadly, this returns the following error:
{"error":{"message":"(#3503) \"[{\"user_generated\":true,\"url\":\"https://i.chzbgr.com/completestore/12/8/13/c9Smb0ba2EGTLepkCgEp2g2.jpg\"}]\" is an invalid value for property \"image:url\" with type \"URL\"","type":"OAuthException","code":3503}}
I was able to successfully get the action to publish using the graph api explorer, but it is not using a javascript object and jquery. I assume I am doing something wrong with the way I am passing the extra parameter. But I just can't figure out what.
Upvotes: 5
Views: 1027
Reputation: 96306
I haven’t tried this yet, but my guess (since it’s not clearly described in the docs) would be that you have to give a string value containing JSON-encoded data like in other similar cases.
image: '[{"user_generated":"true","url":"https:\/\/i.chzbgr.com\/completestore\/12\/8\/13\/c9Smb0ba2EGTLepkCgEp2g2.jpg"}]'
Upvotes: 3