Get a Facebook page stream type - facebook-graph-api

I want to get all the stream of a Facebook fan page.
In my app, i want to display the "post" with a different template dipending on the type of the post.
But when i get the post with FQL or API the type is never the same, and for example for an event the type is "Status", for milestone the type is "status" or "photo".
Does someone know how can i get the real type of the "post"?
Thx for your help

Related

How to determine why a facebook page URL will not return a facebook id?

For the most part, using the graph api, passing in a Facebook page's encoded URL returns the normal facebook id.
For instance, using the Graph API Explorer and passing in https%3A%2F%2Fwww.facebook.com%2Fkendalljenner returns
{
"name": "Kendall Jenner",
"id": "173567062703796"
}
However, for some (pretty rare) FB pages, like http%3A%2F%2Fwww.facebook.com%2Fmargotrobbie, I get
{ "id": "http://www.facebook.com/margotrobbie" }
The question, Why do some Facebook urls not return their Facebook page id through graph api?, suggests that the issue may be that the page is restricted somehow (like for alcohol content). I believe this may be the case, because the Harley Quinn videos in the posts are a bit graphic, but I searched all the info for the page and it doesn't say anything about the content being restricted. In addition, I am using a User access token that is allowed to see the page via normal FB web interface without any apparent restriction.
BTW, for anyone who hasn't seen this before, the id set to the url seems to be the result when facebook doesn't know anything about the URL. Obviously this shouldn't be the case for facebook's own URL.
Not sure what the reason for the apparent difference with the two page URLs indicated, but I did solve the underlying problem of getting the facebook id of the page!
First of all, I had tried the process described here: How to get page id of facebook page, however it wasn't working for me. In my effort to permute all options, I had changed the access token to a "user access token". Turns out, you HAVE to have an "application access token" as is well-documented in said article.
Thanks to CBroe for making me question how I was calling the API...no matter how long I was calling it this way.

How to get Facebook page type

Im trying to figure out with the Facebook API how to retrieve the kind of page. For example: if we go to facebook.com/MyOrganisation that it will return a page type organisation. Or if a location it returns a type of location. Any one has a clue?
All possible fields are in the docs: https://developers.facebook.com/docs/graph-api/reference/page/
Maybe place_type is what you want, try with your Page.

Using Facebook Graph API Explorer to publish an action

Background
I'm creating a simple Facebook application, first time working with Facebook.
* Using an "Action Type" of "Read"
* Using an "Object Type" of "Article"
I can't submit the application because the Action Type shows an error "You, or this app's Open Graph Test User, must have published this action at least once."
Immediate question:
I'm trying to publish the Action using the Graph API Explorer so that I can then submit the app for review.
I tried a GET /me/news.reads which didn't generate an error but only returned a blank results {"data":[]}
Also when I go back to look at the Action Type, it still shows the same error about needing to publish.
I tried the same request as a POST which did give an error "The action you're trying to publish is invalid because it does not specify any reference objects. At least one of the following properties must be specified: article."
On another notes, a more generic GET request I tried /me?fields=posts,feed gets me the data I want in the Graph API Explorer, but what would I set as my Action Type and Object Type to use that request?
Any comments on the overall approach I'm using would also be welcome.
More background: The underlying goal of this is that we want our separate corporate website to pull in the latest post to the Wall on our Page.
Any help would be much appreciated. Thanks.

(Probable) inconsistency in "id"s returned by facebook Graph API and Realtime Updates?

related to Open Graph api for feed returning inconsistent results
When I publish a post on a page's feed using my App, facebook returns some id in the form of <page_id>_<post_id>, but when the same App receives a Real time Update from the same page—say a like or a comment—the parent_id field of the like or comment contains only the <post_id> part!
Is this a bug or what?
Here is the response from facebook engineers -
This is by design. For a realtime update generated by a comment, the parent_id will just show and not include the page_id.
For specific examples, please refer to our documentation (https://developers.facebook.com/docs/reference/api/page/#realtime) and look under the sub-sections "Feed Example."

Facebook graph api, tell "comment" from "like" in the "post" list

after getting the json result of https://graph.facebook.com/me?fields=posts.fields(id,message,story)&access_token=*, how do you tell which one of them is "comment" and which one is "like" you made on some post from the list?
Thank you very much!
I ran the following in facebook's graph api:
/?posts.fields(id,message,story)
which provides the same result as:
/
Note that I used a post id, not a page id. On a page id, you'll see the likes for the page while a post id will show the people who liked a post. The output clearly shows who commented and who liked. If you want to get a number for the count of people who have liked the post, check out Getting from Facebook API total number of likes per post.