FQL returning empty set?

2019-07-17 20:15发布

问题:

I am trying to get my feet wet in the Facebook API and FQL. My query is returning an empty set, and I'm not sure what permissions to change. I had started an old app years ago when the API first came out.

I am trying to use that app and the fql.query test console

For starters, I am trying to get my wall posts:

SELECT actor_id, message FROM stream WHERE source_id = xxxxx limit 50

And the return is:

[]

So then I tried the same query with source_id = yyyyy, a friend's ID, and I got his posts. This is hit-or-miss with different friends.

Questions:

  1. How can I, using FQL, tell whether or not my app has permissions to access this data?
  2. Why can't I retrieve this for my own application, for which I am the administrator?
  3. What permissions do I need to change (for my app? for my profile?) to be able to query my wall posts? What URL lets me update those permissions?

回答1:

How can I, using FQL, tell whether or not my app has permissions to access this data?

You can't, most of the time it should through an error informing you of the missing permission. BUT you can check if your application has granted a certain permission:

SELECT read_stream,offline_access,publish_stream FROM permissions WHERE uid=me()

More about this here.

Why can't I retrieve this for my own application, for which I am the administrator?

If you don't have the right permission you won't get the information you need even if you are the administrator of the app.

What permissions do I need to change (for my app? for my profile?) to be able to query my wall posts? What URL lets me update those permissions?

It's cleary stated in the stream table document. You need the read_stream permission.


Now why you were able to view your friend's posts and not yours is also mentioned in the document:

You can get two types of data when you query this table:

  • You can get public data (viewable to anyone on Facebook) without needing an extended permission.
  • You can get more data if you prompt the user for the read_stream extended permission.

So most likely you have your privacy settings set to high or something. Just get the read_stream permission and you'll be able to retrieve your posts.