Ahmed
Ahmed

Reputation: 113

How to get activity from my app with Facebook Graph API?

I have an app that uses the Graph API to post activity to a user's timeline, however, I want to be able to display this activity within the app itself (and potentially friends' activity, but that's another issue).

I can't seem to find a way to access my own app's activity though. Poking around, I found this: https://developers.facebook.com/docs/authentication/permissions/#open_graph_perms and tried adding permission for user_actions:NAMESPACE, however I can't seem to get the activity.

I can successfully get video/music activity with the user_actions.video/music permission, and calling /me/music.listens or video.watches, however I can't seem to find a way to get this for my own activity.

For the sake of example, let's say my action is "cook," I have tried:

/me/NAMESPACE:cook
/me/NAMESPACE:cooks
/me/NAMESPACE.cook
/me/NAMESPACE.cooks

But nothing seems to work - am I missing something here?

Upvotes: 3

Views: 2645

Answers (1)

Simon Cross
Simon Cross

Reputation: 13345

Your app can read any data that it published in without asking for any other permissions.

You read actions from the same URL you posted them to:

if you POSTed your actions to:

POST https://graph.facebook.com/me/yournamespace:cook?access_token=USER_ACCESS_TOKEN

then you read them by GETing:

GET  https://graph.facebook.com/me/yournamespace:cook?access_token=USER_ACCESS_TOKEN

You can read a users friends actions that your app posted too without any additional permissions - you did post it after all, and that user has already auth'd your app. Again, you just GET:

GET  https://graph.facebook.com/USER_ID/yournamespace:cook?access_token=USER_ACCESS_TOKEN

Upvotes: 3

Related Questions