Get post Using facebook graph api - php

I did one sample to get page post using graph API. But it will fetch all the posts. For example, if the page shares anything from another page, it also fetched from api. I only need the post which is added by that page. Is the feature available in facebook API.
The below URL fetches all the post.
https://graph.facebook.com/page_id/posts?access_token=access_token

According to Facebook Docs for Page Feed
It clearly states that:
/{page-id}/posts shows only the posts that were published by this page.
/{page-id}/tagged shows all public posts in which the page has been tagged.
/{page-id}/promotable_posts shows only the posts that can be boosted (includes unpublished and scheduled posts).
Please check the docs properly and if you want to customize it more then you can do that at your end while parsing the results.

Related

How to add a post's view count into the WordPress API response

This is my first time working with Wordpress APIs, and i'm not a PHP developer. Essentially our client just wanted us to display WordPress articles in our react-native app with simple data like the:
date
title
content
thumbnail
etc..
...anything you'd find in the default response, and this was easy. We simply used the default endpoints like this one: https://demo.com/wp-json/wp/v2/posts?categories=1015
Anyways... Our client now wants to display the "view count" of each article. However, i can't find that data in the default response:
Is there a way to get this view count data, and have it return in the API response, without having to customize every single endpoint?
Thanks

Facebook Graph API Explorer get page specific page feeds

I use Graph API Explorer to get some feeds from my facebook page. So I have something like this:
GET ->/v2.2/my_page_id/feed
which returns me all the feeds from my page. At this point everything is well, the problem is that it returns not only the posts I posted, but also the posts other posted on my page.
What I basically want is to get only my posts which are placed in the center column without the other peoples posts on my page which are placed on the left column.
If I try this:
GET ->/v2.2/my_page_id/feed?fields=from{id}
I will get only the user ID who posted the feed, so I guess I have to put some kind of where clause like :
/where?from{id}=my_user_id
Can anybody help me with this? It seems such a simple thing but I lost lots of hours to make research about this where clause without any luck.
You should use
GET /{page_id}/posts
instead of
GET /{page_id}/feed
if you just want to Page's own posts.
See
https://developers.facebook.com/docs/graph-api/reference/v2.2/page/feed/
/{page-id}/posts shows only the posts that were published by this page.

Import Facebook posts and not just embed them

I am looking at importing Facebook posts and not just embedding a Facebook iframe in the page. I want to be able to get the SEO benefits of having my website news page updated all the time by my Facebook page and I believe if I just use the Facebook embed code this wont work to improve it ?. Does anyone know of a tutorial or plugin for importing posts / pics into a php based website ?.
Thanks
Iain :-)
For this you may want to look at their graph api, https://developers.facebook.com/docs/reference/api/post/
https://developers.facebook.com/blog/post/490/
you need to authenticate to facebook and retrieve the post using the api
or you can use their plugin to display the fanpage posts on your website, it's much simpler.
Social2blog ( http://www.social2blog.com/ ) import facebook posts in your blog, with a creation of Wordpress post and then with real SEO benefits. Furthermore Social2blog permit to decide if you want to point the canonical url to Facebook post. The problem with Social2blog is that it works only with facebook page. Otherwise you can create your own php script, please refer to:
How to pull in Facebook Page posts as blog posts to WordPress?

how to grab content from google plus business page?

friends,
how we can grab posts and comments from gplus business page ?
My page link look like https://plus.google.com/b/xxxxxxxxx/ .
I got the api to get details from an account using the following method.
https://www.googleapis.com/plus/v1/people/108189587050871927619/activities/public?key=yourAPIKey
but i couldnt find any thing for business page.
am using php for developing the code.
Thanks in advance..
A page is a "user" like any other - grab the ID displayed in the URL when you're browsing the page's posts, and look up the public posts for that id.

Facebook Posts and Multiple Actions

Can you post multiple actions (I want to do two) with a wall post using the Facebook Graph API? If so what is the format that should be used for the actions string. I can't get this to work for the life of me.
This piece of documentation describes the parameter as a array of objects containing the name and link. I used json to do this however I can only successfully do one action link and not two.
I think you are talking about the custom app-pecified links displayed in the wall post. No, facebook allows only 1, and tha'ts how the structure of facebook wall post is.
there is written here http://fbdevwiki.com/wiki/FB.ui#method:_.27feed.27 that only one action link allowed

Categories