Graph API Check IN
Hi I am developing an application that will communicate with Facebook Graph API to check in user at a pa开发者_JAVA技巧rticular location (only one).
1) I let the user sign in, and ask for authorization to publish/sign into locations 2) I get the token from facebook and thus acquire the credentials
How do I check in a user? at a location ?
You need to have publish_checkins
authorization for the user. If you get that you can simply do a post to http://graph.facebook.com/PROFILE_ID/checkins
which take several parameters. Please check publishing section of this page.
curl -F 'access_token=...' \
-F 'message=The coffee is just meh.' \
-F 'place=PAGE_ID' \
-F 'coordinates={"latitude":"...", "longitude": "..."}' \
-F 'tags=USER_ID1, USER_ID2' \
https://graph.facebook.com/me/checkins
Hope this will help you.
You can achieve same thing in the Facebook JavaScript SDK. You need "publish_checkins" Extended permission in FB.login
FB.api('/me/checkins', 'post',
{ message: 'Hurrey, At Facebook HQ...!!!',
place: 110506962309835,
coordinates: {
'latitude': 37.4163458217,
'longitude': -122.15198690595
}
},
function (response) {
console.log(response.id);
}
);
精彩评论