Cannot Checkin Through FB.api (javascript)

712 views Asked by At

With the javascript sdk (FB.api), I cannot checkin on behalf of user. (The user has granted publish_stream permission to my app)

Since facebook's API keeps changing, confused for some time. After searching and reading from internet, I think it's the right way to publish a checkin. Any help is appreciated.

var params = {
method: 'POST',
place: 107297282684980,
message: 'hi',
coordinates: {
'latitude': 22.204284439454,
'longitude': 113.54313260065
}};

FB.api(
'/me/checkins',
params,
function(response) {
if( response )
alert('Checkin Completed!');
});
2

There are 2 answers

0
Kent Si On BEST ANSWER

It was deprecated at July 2013. You should check the changes from the URLs provided at the question comment.

And follow the instructions:

https://developers.facebook.com/docs/opengraph/overview/ https://developers.facebook.com/docs/opengraph/getting-started/

0
jafarbtech On

As FB Check-In is deprecated we can achieve the same thing with a post on FB with Location Attached using the following FB Graph Api post.

FB.api('/me/feed', 'post', {
    name: 'SomeName',
    message: 'SomeMessage',
    place: yourLocationID
}, function (response) {}); 

Note : Where yourLocationID is the ID that you will get by the Graph search using https://graph.facebook.com/search?q=yourPlaceName&type=page&access_token=YOURTOKEN