-
-
Notifications
You must be signed in to change notification settings - Fork 191
Checkin and Places
nov matake edited this page Mar 4, 2011
·
3 revisions
You can fetch/publish checkins via Graph API using fb_graph.
Those pages are the official Graph API documents related to Checkin and Places.
- http://developers.facebook.com/docs/api/
- http://developers.facebook.com/docs/authentication/permissions
- http://developers.facebook.com/docs/reference/api/user/
- http://developers.facebook.com/docs/reference/api/checkin/
To fetch an user’s checkins, call FbGraph::User#checkins
.
You need user_checkins
permission to fetch checkins of the access token owner.
You also need friends_checkins
permission to fetch checkins of the access token owner’s friends.
# Get Checkins of Me
FbGraph::User.me(ACCESS_TOKEN).checkins
# Get Checkins of One of My Friend
FbGraph::User.new('John').checkins(:access_token => ACCESS_TOKEN)
# Search Checkins of An User and His/Her Friends
checkins = FbGraph::Checkin.search(:access_token => ACCESS_TOKEN)
To publish checkins, call FbGraph::User#checkin!
.
You need publish_checkins
permission to publish checkins.
Those arguments are supported.
coodinates | Required | A JSON object which has latitude and longitude (ex. {"latitude": 36.538329, “longitude”: 140.53093}) |
place | Required | The identifier of the place to checkin. Place is a Facebook Page. |
message | Optional | Free text |
# Search Places
places = FbGraph::Place.search('Cafe', :center => '35.603009,139.543747', :distance => 2000, :access_token => ACCESS_TOKEN)
# Checkin One of Them
place = places.first
FbGraph::User.me(ACCESS_TOKEN).checkin!(
:coordinates => place.location,
:place => place
)