Tuesday, March 13, 2012

Changes to Tagging on Photos

Some changes have taken place to the tagging structure and will likely break.

Please download an updated copy of the API to correct this problem.

We are currently on Version 1.0.4

Wednesday, March 7, 2012

Sample application now available

There have been a number of requests for a sample application so I've put together a basic web application to show you how to do basic posting and authentication.

To use this sample site you will need to modify the application ID and secret in the web.config file as well as replace the url for authentication with the one that matches the location in which you are running it. This url for authentication must also match your settings in your app on facebook, otherwise facebook will not authenticate it.

Download Sample Application

Monday, February 13, 2012

Changes to Authorization affecting User ID retrieval

Recently Facebook made a change to their authorization structure that no longer returns the ID of the authenticating user in their initial response.  As a result you will not be able to use the user’s ID until you have made a request with the returned token for the users info.

Here is a short example of how this works.

SI.AuthenticateUser("http://localhost:55990/default.aspx", New SessionInfo.PermissionsEnum() {SessionInfo.PermissionsEnum.user_about_me, SessionInfo.PermissionsEnum.email, SessionInfo.PermissionsEnum.read_stream})
Dim UR = SI.ReadFacebooAuthResponse
If UR.Authenticated Then
     Response.Write("Success" & "<br>")
     Response.Write(UR.UserID & "<br>") 'no id present
     Dim RQ = New  Functions.Requests(SI)
     Dim U = RQ.GetUserInfo 'Request the userinfo object
     Response.Write(U.id & "<br>") 'id is now present
     Response.Write(U.username & "<br>")
Else
     Response.Write("Fail" & "<br>")
     Response.Write(UR.Access_Token & "<br>") ‘no token found
     Response.Write(UR.Error & "<br>")
     Response.Write(UR.Error_Description & "<br>")
     Response.Write(UR.Error_Reason & "<br>")
End If

We will follow up with facebook to find out why this change was made and keep you posted if and when they decide to revert back to including the ID in the original auth request.

Sunday, July 3, 2011

Edit the link name on your post.


Our latest version now supports the addition of an action to a post that allows you to control the name of the link that is displayed to the FB user.  You can only add one action item and this is the format to use.

Dim
P As New Post
P.name = "test name"
P.message = "test message"
P.link = "cnn.com"
P.caption = "test caption"

Dim A As New ActionObj
A.name = "Comment Now"
A.link = "http://www.cnn.com"
P.actions.Add(A)
Posts.PublishCreate("me", P)

Wednesday, May 25, 2011

How to Comment on a Post

Imports Branches.FBAPI
...
Dim SI As New SessionInfo("[access_token]"))
Dim Posts = New Functions.Posts(SI)
Dim C As New Comment
C.message = "test comment"
Posts.PublishCreate("[objectID to post comment to]", C)

Posts and Comments Retrieval

This is an example of how to get a list of posts on a users wall and read any comments on those posts. You can also request comments for a specific post.

Imports Branches.FBAPI
...
Dim SI As New SessionInfo("[access_token]"))
Dim Req New Functions.Requests(SI)
For Each P In Req.GetPosts("me")
      TestContext.WriteLine(P.id)
      TestContext.WriteLine(P.from.name)
      TestContext.WriteLine(P.message)
      TestContext.WriteLine(P.link)
      TestContext.WriteLine(P.comments.count)
      'Return comments from data on post
      For Each C In P.comments.data
            TestContext.WriteLine(C.from.name)
            TestContext.WriteLine("Comment: " & C.message)
      Next
      'Return comments for a specific postID
      Dim C2 = Req.GetComments(P.id)
      For Each C In C2
            TestContext.WriteLine(C.from.name)
            TestContext.WriteLine("Comment: " & C.message)
      Next
Next

The above emaple is based on unit testing code

Working with friends and friend lists

To get a list of a user’s friends you can use two methods

1.    Get a list of all the friends for a use.
2.    Get a list of custom lists that the user has created and then view the friends for that particular list.

This is code from our unit testing but you can replace the testcontext.writeline with your preferred output method

Imports Branches.FBAPI
...
Dim SI As New SessionInfo("[access_token]"))
Dim Req As New Functions.Requests(SI)
 ' Get a list of a users friends
For Each [Friend] In Req.GetFriends
       TestContext.WriteLine([Friend].name)
Next
 ' Get a list of friend liss and then return the users for that list.
Getting Friend Lists
For Each FriendList In Req.GetFriendLists
       TestContext.WriteLine(FriendList.name)
       For Each [Friend] In Req.GetFriendList(FriendList.id)
              TestContext.WriteLine("     " & [Friend].name)
       Next
Next