We need to get number of friends added by Facebook user in last month. We have searched in the Graph API,but didn't get any solution.
I think you should use FQL notification.
But notification actually are limited to last 7 days.
Try this query:
SELECT created_time, sender_id, title_html, href, object_type
FROM notification
WHERE recipient_id=me() and object_type = 'friend'
Update:
Another approach, a little bit tricky.
You should be able to have a look at older friendship into your stream
:
SELECT created_time, description FROM stream WHERE source_id = me()
and (strpos(lower(description),'are now friends') > 0
or strpos(lower(description),'is now friends') > 0)
limit 50
In this way you get all rows containing the sentences are now friends
or is now friends
, (note that sentences words depends from customer(?) locale settings). So you'll match all rows:
Each query of the stream table is limited to the previous 30 days or 50 posts, whichever is greater, however you can use time-specific fields such as created_time along with FQL operators (such as < or >) to retrieve a much greater range of posts. https://developers.facebook.com/docs/reference/fql/stream/
Update 2:
If you want use only graph api, as far I know you have same limitation of fql (i.e. you're limited to last 7 days).
https://graph.facebook.com/me/notifications?include_read=1
But this case, you cannot filter for object_type
and you must find all title
containings "accepted your friend request"
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