how to read facebook page feed via app access token? - facebook-graph-api

How could I get the facebook page feed, when the user isnot loged in.
I could get app access token,after that how I need to fetch data via graph api.
Please provide a sample and could I test that in facebook explore tool.?

All you really need to do is make a request to:
https://graph.facebook.com/v2.0/PAGE_ID?access_token=APP_ACCESS_TOKEN
So, for example, to get CocaCola's page feed, the request would look something like this:
https://graph.facebook.com/v2.0/40796308305/feed
The endpoint you're dealing with here is /{page_id}/feed. The relevant documentation can be found here - https://developers.facebook.com/docs/graph-api/reference/v2.0/page/feed.
For your convenience, here is a link directly to the API explorer with the relevant query:
https://developers.facebook.com/tools/explorer/145634995501895/?method=GET&path=40796308305%2Ffeed&version=v2.0

Related

Extract my timeline posts from Facebook Graph API

I am trying to extract my posts, via Graph API from facebook. I used some basic code snippets but they don't work. I can not get my feed even in the Graph Explorer. It always says that I don;t have the permission and I have to submit my App for review and provide a video tutorial on how I use the extracted posts.
But I want to extract just my posts, I don't care for anybody elses. Do I seriously need FB App review to do that?
This is what I get with my token from my app:
user/posts requires additional contract signing:
Use /me/posts with your own App, with your User Token and authorize with the user_posts permission. This works without any approval from Facebook - for your account and your App only, of course. I just tested if it still works in the Graph API Explorer and it did: https://developers.facebook.com/tools/explorer/108138225915615/?method=GET&path=me%2Fposts&version=v5.0

Embedded Facebook feed on website not possible after Graph Api 2.5?

I've been coding a website using and modifying Bootstrap template. End of summer I left the site as it was, but once returning there recently I noticed the Facebook activity feed (newests posts and such) had dissappeared from my front page. Reading from Facebook Developers; after the release of Graph Api 2.5 adding Facebook feed on your website is no longer possible? Is there any other way to get the Facebook feed back on the site? I had been using iframe on my site while it was still working.
There are two main steps involved in embedding Facebook page feed in your website- 1. Getting Facebook Access Token, 2. Calling the Graph API passing the access token.
1. Getting the access token - Here is the step by step process to get the access token for your Facebook page. - Embed Facebook page feed on my website. As per this you need to create an app in Facebook developers page which would give you an App Id and an App Secret. Use these two and get the Access Token.
2. Calling the Graph API - This would be pretty simple once you get the access token. You just need to form a URL to Graph API with all the fields/properties you want to retrieve and make a GET request to this URL. Here is one example on how to do it in asp.net MVC. Embedding facebook feeds using asp.net mvc. This should be pretty similar in any other technology as it would be just a HTTP GET request.
Sample FQL Query: https://graph.facebook.com/FBPageName/posts?fields=full_picture,picture,link,message,created_time&limit=5&access_token=YOUR_ACCESS_TOKEN_HERE

Instagram API Pulling Images Without Authorization Page

So I was going through Instagram's API and I implemented it. However it isn't as useful as I thought it would be because when trying to get and OAuth2 token a user is taken to a page to authorize them in what looks to be and effort of insuring that the user realizes that they are about to view and share Instagram content with my application. This all makes sense to me although not ideal. You can find it in detail here(Step One: Direct your user to our authorization URL).
Then I saw this press release from a company called Celtra who says they can pull the the most recent images off any Instagram feed and put them in an Ad. I checked it out and somehow they are pulling the images of other companies without this authorization page I am encountering. Basically without page scrapping I don't know how to do this with Instagrams API, and I realize scraping violates Instagrams terms of service. Does anyone have this functionality, where I can pull down images from Instagram and not take a user to an authentication page working legally as I am assuming Celtra is doing? Guidance or documentation on how to achieve this would be ideal.
Instagram recently added an endpoint that will allow you to any instagram account's photos without oauth or needing access_token, you can specify client_id and make API call to get photos.
Just register for an app account at here and add the client_id to this endpoint and make call:
https://api.instagram.com/v1/users/3/media/recent/?client_id=YOUR-CLIENT_ID
You only need access_token to get users' likes, follower feed and to like/comment/follow.
update: you need to have access_token with the new API changes, cannot
access API with just client_id anymore
To do this simply, you could authenticate your app from a dummy profile or your own personal profile and then use the access_token to request the feeds of any account. Then, when an end user goes to use your product, instead of authenticating them, you can just pull content from the Instagram API using your access_token.

Django and Post to Facebook (no authentication)

OK, I need some help understanding the process behind Facebook's website integration process and how I can integrate it into my web app....
In its most basic form, my site stores and displays users' comments about products (there's more to it than that, but that's all that's relevant for this question). What I'd like to do is allow them to post that comment, together with the name of the product (and my site), to their Facebook wall by clicking a button.
I do not need the users to log in to my site at all, either with Facebook or any other authentication system and the Post to Facebook part is optional.
Obviously if they decide they do want to post their comment to Facebook, then they'll need to login, but I'd rather temporarily take them away from the page to login, post and then be brought back to my site.
What I need to know is how much of Facebook's APIs, Open Graph and Auth systems do I actually need to integrate?
I had hoped that I might be able to generate a simple link to Facebook with their comment embedded as a POST element...?
I'd be really grateful if someone could point me in the right direction!!
(P.S. I need a similar solution for Twitter, but I think that's easier!?!)
The Feed Dialog doesn’t allow including of a pre-set message any more, so you’d have to make that post via the Graph API if you want to pre-fill the message (and even then, you should only do so, if you’ve given the user the possibility to edit the pre-filled message first).
See here for how to make a post on a user’s behalf via Graph API, https://developers.facebook.com/docs/reference/api/user/#posts
You can do that all client-side, if you embed the JavaScript SDK into your page.
You need to set up an app on FB, then have the user connect to it (using FB.login), ask for the necessary permission (publish_stream) while doing so, and after successful login use FB.api to make the Graph API call.

Facebook API Like a Page with Auth Token

I've got a Facebook oauth token and I'm trying to Like a page for a user who has given me permission to do so. Assuming 123456789 is the id of the Facebook page the user wants to Like, I post to this page and get the following error:
https://graph.facebook.com/123456789/likes?access_token=...
{
"error":{
"type":"OAuthException",
"message":"(#3) Application does not have the capability to make this API call."
}
}
This page of the Facebook documentation (https://developers.facebook.com/docs/reference/api/) says:
You can comment on or like any object that has a /comments or /likes
connection by posting to https://graph.facebook.com/OBJECT_ID/comments
and https://graph.facebook.com/OBJECT_ID/likes, respectively
The user wants to Like a Facebook Page and the Page documentation (https://developers.facebook.com/docs/reference/api/page/) shows that it does have a /likes connection, so it should be Like'able via the api... but it's not working. Any ideas?
Currently this is only possible with the old (and DEPRECATED) REST API. Using the method "pages.addFan". Though this method is not visible in Facebook's API Documentation.
So I assume that this is also possible somehow with the new Graph API, because their Facebook mobile apps will need to move on to their new APIs soon, and they make use of the Page Like function.
What's really weird, is that their brand new iPad app, is based on the old REST API! Interesting...