Threads about FB -object, JavaScript SDK, OAauth 2.0 and Graph API? - facebook

I cannot understand the FB API. I feel the problem is because I cannot understand the protocals OAouth draft page (source, page 19). Well firstly it was so but now I understand that OAouth 1.0 and OAuth 2.0 are totally different protocols although for the same goal, apparently..
Perhaps the most essential stuff are FB docs about authentication here and a blog post
here. I am trying to categorize here threads to dig deeper into the FB API.

I cannot find things such as picture or friends in the Graph API -object
That’s because you didn’t ask for them …
To get a user’s friends, you have to query the /userid/friends connection.
And for the user’s picture, you can just use the address https://graph.facebook.com/userid/picture as the image src – this will redirect to the actual picture.
It’s all described here: https://developers.facebook.com/docs/reference/api/user/ under „Connections”

I am trying to organize here things.
Trials and some Confusing Points with Questions
Some code here and in history. Logs in history.
[solved] Trial 1 shows a cover picture from FB but not using FB API. FB -object does not store the picture URL! You need to use the POST -url.
[solved] Trial 2 with /userId does not request friends (thanks to one answer) but now a new problem with authorization, solved by this answer here.
[solved] Trial 3 with /userID/friends does not work due to no access-token. Solution here.
[solved] how do the many inner-most FB.login here
to get the access token? Moved this q here.
[solved] what does the __PROTO__ mean? -Unreliable, you are not going to use it (according to the chat -msg in history).
THIRD-PARTY MATERIAL
Manuals
Graph API here
JS SDK here
The OAuth draft paper about the webserver flow here.
FB.login here
Perhaps related
[URL -method] facebook graph api picture
[URL -method] facebook graph api photos retrieve
[URL -method] facebook graph api retrieve wall photos
[PHP] How to use Facebook graph API to retrieve fan photos uploaded to wall of fan page?
[PHP] Pulling in photos via Facebook Graph API
[Unsolved] https://stackoverflow.com/questions/7819091/can-i-retrieve-facebook-photos-through-graph-api-that-are-only-shared-with-frien

Related

Get user's detailed newsfeed(wall) posts in Facebook

I would like to build a project to know users' behavior when they surf facebook website, especially the advertisements showing in their timeline wall. I have learned the basic idea of facebook graph api, knowing how to access the users' information and their feeds. However, I found that the feeds returned by facebook graph api is not "exactly" what user really see when they open facebook url in their browser. First, in graph api, it doesn't show the advertisements posted by sponsors. Second, the feeds returned by facebook api seem only regarding to my own posts(e.g. the photo tagging me, the posts tagging me). So, I would like to know how to access these information to rebuild a testbed that looks like exactly same as the real facebook website to record people reaction to it and continue my research?
Any idea is welcome ^^
This isn't really possible or rather I don't know any API (Facebook/Twitter/etc) that would do this to their third-party developers. The point of the API is to pull user data, not ads.
Also it sounds like you are using /me/posts or/me/feed instead of /me/home

Post Facebook Comment with Link Preview via Facebook API

Facebook recently added link previews to user comments.
http://www.insidefacebook.com/2011/07/21/facebook-comment-previews/
My question: is there a way to display this link preview using any of the Facebook APIs and publish_stream permission? (Graph, rest, etc)?
I've tried posting a URL in the body of a comment using the Graph API /comments endpoint, but no link preview is shown.
The feature might still be too immature to allow this, but I'm wondering if any one has tried it and got it to work in some way.
Sure. Just post a comment (for example) with youtube video and it will transfer to embed one

Programmatically posting Facebook comments

My application has obtained publish_stream permissions for a Facebook user.
I'd like to allow the user to post comments for a target URL directly from my mobile application, rather than opening up an embedded browser that then shows the Comment Box plugin. That is, the user doesn't necessarily want to post the link to their feed -- rather they want to participate in any Facebook comment discussion that surrounds that URL.
Naturally, I can read the comments for any URL via the Graph API (eg: a techcrunch article) but I do not know how, or if I can add comments to an arbitrary URL programmatically.
Would love to hear any other suggestions or workarounds as well. My hope is to piggy back on Facebook comments to allow my users to have a conversation surrounding URLs of interest to them. If at all possible, I'd also prefer to use Facebook, though I can see using Disqus or similar services would be another possibility.
Use graph api, demo comments here
make POST to
http://graph.facebook.com/comments/?ids=http://techcrunch.com/2011/07/22/big-surprise-the-ipad-trumps-android-tablets-at-the-office/
with field message and value "yourmessage"
I genuine Facebook API bug.
Cannot comment via Graph API on Comments Plugin (Probably try Legacy API)
Graph API

Streaming Facebook Pages Wall (not just the pages posts)

I have looked on 100 forums looking for a simple answer for how to stream every post on a Facebook page's wall (not using the like box for just the pages posts, but everyone's posts). I am the admin of the page and I am already using the like box for my posts so I understand that, however the developer pages of Facebook are too confusing for such a simple task. I will be inserting the stream into an HTML page which will be hosted on www.1and1.com so it can handle most, if not all code.
I know it is a lot to ask but is there evem someplace online that will offer plain step-by-step instructions for my specific needs?
If the social plugins they make available aren't sufficient, you could just pull in the feed with the Facebook graph api using the javascript sdk (easiest) or there is probably an SDK for whatever programming language you know. For example, you can see a list of posts on the coca cola page using the Facebook graph explorer:
https://developers.facebook.com/tools/explorer/?method=GET&path=cocacola%2Ffeed
The /page/feed method needs an access token, but you can use the graph explorer to get an offline_access token that you can use to pull the data in. This may eliminate javascript sdk usage though unless you want to first prompt users to authenticate your application. But otherwise you would just parse the json feed that is returned in the url indicated in the graph explorer (and add your access_token to the end of the url).
Here is a good PHP tutorial on how to display a groups feed on a web page. It would be just as easy to display the posts from a page (since you are the admin)
Just replace the group ID with the page ID. Here is a link to the feed for the Facebook Platform feed graph api results. More info on FB Pages here.

Post status update to Page Wall

I'am really new to all this Facebook development, and I wanted to integrate Facebook within my personal website.
I am now trying to test if what I want is possible.
I want to post a status from my server, via php/js to my Page in Facebook.
How can I do so?
B.W.
I saw that there is this FBJS function called "Facebook.streamPublish"
But I don't know how to integrate it.
Is there any possible way to do so?
Can you give me an example?
-Secondly, what is an access token?
You get an access_token after facebook authenticates you. You will need this access_token for all subsequent API calls. You can find the details here:
http://developers.facebook.com/docs/authentication/
You can use graph API for publishing on the wall and doing other allowed actions. Details of publishing api can be found here:
http://developers.facebook.com/docs/reference/api/post/
But do have a look on the facebook policy, because publishing automatically to a wall is considered violation.
http://developers.facebook.com/policy/