hello world
hello world

Reputation: 807

Get page feed from Facebook public page Android

Iam trying to fetch the list of Page feed from a Public page from Facebook into my Android app.

I have the Page Id and the access_token for the page. Iam trying to fetch the feed with a request using the following url:-

"https://graph.facebook.com/page_id/feed?access_token=sometoken"

But doing the above gives me the following error:-

Tried accessing non existent field (feed) on node type (Open Graph Object)

I tried it from Google chrome's Postman extension as well. Gives me the same error.

How can I solve this? Any help would be appreciated.

Upvotes: 3

Views: 2468

Answers (2)

Pooja Gaonkar
Pooja Gaonkar

Reputation: 1566

If the page-id is a numeric value, chances might be that you are getting the wrong value.

You might want to try using either of the below solutions :-

1) Use page username instead of the numeric page-id.

2) Replacing feed with posts.

Something like so:-

"https://graph.facebook.com/page-username/posts?access_token=sometoken"

Upvotes: 7

Tobi
Tobi

Reputation: 31479

To me, the error message hints that the page_id you're using is not a real page_id. You're replacing it with a real numeric id in the request, right? If the object_id is a page, the request should work.

You can check the type of the object_id with

/{object_id}?metadata=1&fields=id,name,metadata{type}

For example, for the CocaCola page

/40796308305?metadata=1&fields=id,name,metadata{type}

it returns

{
  "id": "40796308305",
  "name": "Coca-Cola",
  "metadata": {
    "type": "page"
  }
}

Upvotes: 0

Related Questions