Firstly, to explain the situation:
user_events
(screenshot below){user_id}/
works and returns the basic profile.{user_id}/permissions
works and returns the permissions (inc user_events
, screenshot below){user_id}/events
always 'works' but returns and empty array.I have tried testing with 'me' instead of the logged in fb_user_id and get the same empty data result. If I test from my own admin testing account, the user_events data is always populated with data. I have tried with less/no parameters than the screenshot below, all work fine for test users but not for live users.
Many thanks for any help!
screenshots:
My app is in development mode. You can also easily create and use testing users, customize them to your needs and log in to the account, or you can add a real facebook user to your account and assign him the tester role.
I log in with Ellison Clinton and create an event
I can retrieve via api the /events
Then I switch the facebook app to production and delete the user from the test role
I can retrieve the user information
but I can not retrieve the previously created event
Maybe you did not complete the review process for user_events
?
You can access the data in development, but not in production. I also did not complete the review process, but I can access the user_events
data.
"If your app is in dev mode you should be able to get page access tokens with any permission for anybody who has a role on your app. If you just want to manage posts on your own page or the pages of users who have roles on your app, you'll be able to do so in development mode without submitting for app review." - Response from Facebook Developer Support
You may need to perform the
also consider filing a bug and including the link here
The only possible scenario is that the token you are using does not include the user_events
permission.
A request to /users/events
with token missing the user_events
permission will return status 200
and data: []
, no error messages in the response.
I tested this scenario on the Graphql Facebook Explorer and the request does not return an error message. A debug message is displayed in the Api explorer
, but it is not explicitly included in the response.
I exported this request as curl and this is the result
~ $ curl -i -X GET "https://graph.facebook.com/v3.3/10210855772523702/events?access_token=TOKEN"
HTTP/2 200
content-type: application/json; charset=UTF-8
facebook-api-version: v3.3
x-fb-debug: h1WInt+yxtkm/1isTGfG2cd9JX8HAx5R5A9U/QC4k2lRrJ5mrKYaInR2Mm6XQ5UOrdSquAgWKnYj2jiTw6fwLQ==
{"data":[]}
You can retrieve the debug info passing the param debug=all
in your /users/events
request as in the curl
example below:
~ $ curl -i -X GET "https://graph.facebook.com/v3.3/10210855772523702/events?debug=all&access_token=TOKEN"
HTTP/2 200
{"data":[],"__debug__":{"messages":[{"message":"The field 'events' is only accessible on the User object after the user grants the 'user_events' permission.","type":"warning"}]}}
My advice to you is to add the parameter ?debug=all
to your request and include the result of the response in your question, so that we can assist you troubleshooting.
Below are the other test I performed with the Graphql Facebook Explorer
and I was able to retrieve the events.
STEP 1. Head over to Facebook Graph API Explorer
STEP 2. Generate a Token
get token -> get user access token
and add the user_events
permissionSTEP 3. Run the queries
Use the endpoint /me?fields=id,name
to retrieve your user-id and then:
/{user-id}
/{user-id}/permission
/{user-id/events
as you can see from the pictures below, /events
returns data: []
, while the /permissions
endpoint includes the user_events
permission.
My Facebook user did not join any event in the future. Creating an event and repeating the test returned some results.
The images below showcase my test cases
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With