What is the correct syntax for triggering a “like” action via FB’s js sdk? A custom action looks like this:
FB.api('/me/recipebox:cook', 'post',
{ recipe : 'http://www.example.com/pumpkinpie.html' });
According to: https://developers.facebook.com/docs/opengraph/actions/#create
Edit – This is what I ended up using:
$("#testLink").click(function(){
$.post("https://graph.facebook.com/<?php echo $user_profile[id]; ?>/og.likes",
{
access_token: FB.getAuthResponse()['accessToken'],
object: "http://www.matrym.com/fb/temp.php"
},
function(data) {
alert("Data Loaded: " + data);
}
);
});
Once you satisfy the following conditions…
you call the API like so:
Reference: https://developers.facebook.com/docs/opengraph/actions/builtin/likes/
“Likes” have to be pre-configured by webmasters, otherwise Facebook has no idea what you’re actually “liking”. Each like has an object id associated with it. If it’s your own website, you have to set up what on your site can be liked (and FB associates an ID with it), then you can submit a like on the user’s behalf for that object.