user1217055
user1217055

Reputation: 91

(#3) Application does not have the capability to make this API call. JavaScript SDK

I am trying to like a post with the JavaScript API, like this (id is the post ID):

FB.api('/'+id+'/likes', 'post');

For example, FB.api('/55353596297_10150952824706298/likes', 'post');

This returns "(#3) Application does not have the capability to make this API call".

Upvotes: 5

Views: 13131

Answers (2)

Óscar Palacios
Óscar Palacios

Reputation: 561

Your app needs the publish_actions permission. My code:

FB.api(
    '131389306871851_642563079087802/likes',
    'post',
    {access_token:yourTokenHere}, // from authResponse.accessToken
    function(r) {
        console.log(r)            // Prints "true"
    }
);

Upvotes: 0

Daniel Li
Daniel Li

Reputation: 15389

Ensure that you have the permissions to affect this. Most applications simply have the PUBLISH capability (feed) and basic permissions.

Now, if you're asking to retrieve the Likes for a given pool of users, aim to use:

FB.api("/likes?ids=55353596297,55353596298")

For retrieving multiple user interests.

Upvotes: 2

Related Questions