1

I'm trying to use GraphAPI for retrieving various posts using a search query/keyword from Facebook.

This is what I tried:

new GraphRequest(
    AccessToken.getCurrentAccessToken(),
    "/search?q=solareclipse&type=post",
    null,
    HttpMethod.GET,
    new GraphRequest.Callback() {
        public void onCompleted(GraphResponse response) {
            /* handle the result */
        }
    }
).executeAsync();

but I got this error:

{
  "error": {
    "message": "(#11) This method is deprecated",
    "type": "OAuthException",
    "code": 11,
    "fbtrace_id": "AZD1YH0em2M"
  }
}

Has Facebook completely taken back the privilege of searching through it's public posts or is there some other way available?

Hammad Nasir
  • 2,889
  • 7
  • 52
  • 133

1 Answers1

2

Since Graph API v2.0 it is no longer possible to search through public posts.

There is a public feed API (https://developers.facebook.com/docs/public_feed), however the access is limited to certain media companies only.

CoGe
  • 168
  • 13
  • Then can I get posts from my news feed or from my friends's profile? – Hammad Nasir Aug 23 '17 at 12:38
  • Yes you can read all posts from you own account or your friends account, if you or your friend has allowed your Facebook App to get access to your walls post. For further information please read https://developers.facebook.com/docs/graph-api/reference/post/ and https://developers.facebook.com/docs/graph-api/reference/v2.0/page/feed – CoGe Aug 23 '17 at 12:57
  • Thanks for replying. Actually, I want to read posts from my newsfeed and not my timeline. `/me/feed` returns my timeline's posts. How can I get posts from my newsfeed? – Hammad Nasir Aug 23 '17 at 12:59
  • 1
    https://developers.facebook.com/docs/graph-api/reference/v2.10/user/home As of October 6th, 2015, this endpoint is no longer available. So this means it is no longer possible to get access to the news feed. You are only able to get access to your own timelines post. – CoGe Aug 23 '17 at 13:05
  • It means I can't read even the posts on my newsfeed. Graph API has so many limitations!! – Hammad Nasir Aug 23 '17 at 13:07
  • 1
    Afaik they limited the feed request because of the exceeding traffic. I think your question is answered now even if you did not get the answer you wanted to hear ;-) – CoGe Aug 23 '17 at 13:10
  • Hey, do you know how to use Instagram API? I want to get posts from Instagram in my android app using various hashtags. Do you know how to do it? – Hammad Nasir Aug 26 '17 at 23:31
  • Please use another question and mark this Answer as solved. – CoGe Aug 29 '17 at 09:48
  • I have marked the answer as solved and for retrieving instagram posts I'm using Instagram4j library but it is causing some errors on which I've asked a question here: https://stackoverflow.com/q/45802830/6144372 and you can find more details about the continuous errors it is causing in this chat: https://chat.stackoverflow.com/rooms/152966/discussion-between-hammad-nasir-and-razvan – Hammad Nasir Aug 29 '17 at 19:34