I want to retrieve the current user's notifications from the past 8 hours. I'm using the Graph API Explorer on FQL mode before I put this into my app. On permissions, I have user_about_me and manage_notifications. The request i'm searching for is this:
SELECT notification_id FROM notification WHERE recipient_id={0}
But it returns:
{
"error": "Request failed"
}
What am I doing wrong?
The error Request failed
generally occurs when the your request in not correct.
If you read the documentation properly, this API is used to fetch -
The current user's notifications
So, only valid recipient_id could be the current user's id or me(); not his friends or any other user.
If you have tried the current user's id to the recipient_id, that means the id you've provided with {0} is not correct (some syntactical error).
So, instead you could simply write recipient_id = me()
Related
I've been trying to query what people have posted on my wall as a quick metric of closeness. I've tried both FQL and the Graph API to make these queries without a problem...
FQL:
SELECT actor_id FROM stream WHERE source_id = me() AND message != "" LIMIT 50
Graph:
FB.api('/me/feed?fields=from&limit=50', function(feedresponse) { //do stuff });
Testing these in the Graph Explorer when the application is set to "Graph API Explorer" returns the values I want - my own and other's posts on my wall.
However when the application is changed to my own application, "Fingerprint", the values include my likes, my recent friendship notifications, etc... information I don't want returned and that completely pollutes the query.
I've still gotten the correct results by passing the Graph API Access Token like so:
var access_token = "CAACEdEose0cBALLruchzIKJ1ewgvcjpPJmo1amJwbMHGYyuk544om8hDILt0ZBXiUAriiNI7VY2g1OOwlEgV4bVyCWZACOf2djD1rYBTIwxBnmseNHUm6qybvus23F4AShctQl3wu0rpPS5ZBh68ypVoDMgyyXEGnu6uXBbzOJ7Tx43m2xHsseo1oiU7A80oelxphhidgZDZD";
FB.api('/me/feed?fields=from&limit=50', { access_token : access_token}, ...
Though it works - it definitely doesn't seem like the right way. Can anyone explain why the results are different and how I can get my feed without the other bullshit FB sends me when I'm using the User Access Token with my App.
This should be an easy one. All I want it the user's profile url.
I've tried the following FQL:
SELECT profile_url FROM standard_user_info WHERE uid = me()
but get the Request Failed error. I'm using the Graph API Explorer / FQL Query and have the latest Access Token.
Basically I'm looking for the FQL equivalent to this Graph API call:
https://graph.facebook.com/me?fields=link
Thanks for the help
If you read the documentation properly, you'll notice that-
standard_user_info requires the APP_ACCESS_TOKEN, instead of USER_ACCESS_TOKEN. You can get the App Access Token from the Access Token Tool, for the testing.
You can get the information about the authorized app users only.
So, you can test it like this-
SELECT profile_url FROM standard_user_info WHERE uid = USER_ID
Note: Don't use me() (since you are using the app access token now which didn't recognize me()), instead use you ID)
I've set up a subscription so that my app receives realtime updates for a specific page. This works as expected, and I'm receiving updates when a user posts to the page.
The update only contains the page id, so I then use the Graph API to get the details of the post. The problem is that the post id in the realtime update isn't valid and I get an error from Graph API.
If I query the page's feed, the post shows up there with a different (correct) id.
The correct id consists of <page id>_<post id>. The one in the realtime update is just the <post id> without the prefixed page id.
The data in the realtime update:
{
"object":"page",
"entry":[{
"id":"<page id>",
"time":1372177485,
"changes":[{
"field":"feed",
"value": {"item":"post", "verb":"add", "post_id":<post id>}
}]
}]
}
The Graph query:
http://graph.facebook.com/<post id>
Response:
(GraphMethodException - #100) Unsupported get request.
The Graph query is being performed using a long-lived (non-expiring) page token. I get the same response using the Graph API Explorer tool (https://developers.facebook.com/tools/explorer) and also when using a short-lived user token.
Obviously I could simply prepend the page id onto the given page id to generate a valid id, but that's not very robust, should the format change at any time. Why isn't Facebook returning valid ids? Is there something I'm doing wrong?
I am unable to retrieve Status using FQL for Some Users...for Most of User it is working fine.. but for Some Users not ...
FYI Message is Public and Visible to all friends.
I unable to find what is the problem...Below is The Query..
SELECT status_id, message FROM status WHERE uid in (XXXXX,XXXXX)
User Must Need to Allow My Status Update under Privacy Settings>> How You Connect>> How people bring your info to apps they use
I have managed to get a list of new Facebook Notifications but can't seem to find a way of marking them as read?
I am using FQL with the PHP SDK.
Please can someone point me to some documentation with examples.
To mark a notification as read, POST to
graph.facebook.com/NOTIFICATION_ID
with param "unread"=0.
If you've received the notification object via Grapth API, NOTIFICATION_ID equals the id of the notification object.
If you've received the notification object via FQL, you'll have to build NOTIFICATION_ID as follows:
"Notif_" + userId + "_" + notification_id.
For example if current userId is 123 and notification_id from FQL is 456, NOTIFICATION_ID should be:
notif_123_456
and the POST becomes:
graph.facebook.com/notif_123_456
with parameter unread=0
You'll need 'manage_notifications' permission.
To read notifications, you will need to get manage_notifications permission from the user. (Presuming you already have that is you can getList).
To mark a notification as read you need to use:
notifications.markRead
You can find information on this page.
http://developers.facebook.com/docs/reference/rest/notifications.markRead/
You cannot use straight FQL to mark a notification as read and you can only mark notifications that have been created (as I am led to believe) during the current user session.