Solved

doing a facebook checkin using the graphi api in asp.net

Posted on 2011-03-25
10
820 Views
Last Modified: 2013-11-10
I understand that you are suppose to call the api in graph to do this, but is it a get or a post, and how do you do it. I have tried to do this, both as a post and as a get, and nothing is showing up when I look at it in facebook and not exactly sure why. So any help would be appreciated.
0
Comment
Question by:JDEE8297
  • 6
  • 2
10 Comments
 

Author Comment

by:JDEE8297
ID: 35220734
this is the call in the facebook documentation

curl -F 'access_token=...' \
     -F 'message=The coffee is just meh.' \
     -F 'place=PAGE_ID' \
     -F 'coordinates={"latitude":"...", "longitude": "..."}' \
     -F 'tags=USER_ID1, USER_ID2' \
     https://graph.facebook.com/me/checkins

In the documentation it is says it s the same as the facebook post, but when I call it, it blows up as being unsupported.
0
 

Author Comment

by:JDEE8297
ID: 35222495
this is the url that is called

https://graph.facebook.com/myprofileid/checkins?access_token=110520359027296|5676c71d774f0f0f934893cd-100002162196933|lKwplOd0Tv5gvvzpUR4Y3hbZ9fc&message=njknknkn&place=151627728182096&coordinates={latitude:42.91,longitude:-85.51}

and I am sure the token will have expired by now, I have tried this as a get and I get the message unsupported post request, and I have tried it as a get and don't see anything on my page wall or my own for that matter.

And the url is straight from the documentation on facebook, so not sure why it doesn't go through.
0
 

Author Comment

by:JDEE8297
ID: 35222531
and this is the result I get back

{"data":[]}
0
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 
LVL 82

Expert Comment

by:leakim971
ID: 35228010
0
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 total points
ID: 35228029
0
 

Author Comment

by:JDEE8297
ID: 35228341
@LeakIM971 hey long time no talk, you helped me out on another facebook related issue, which was where I wanted to parse out a json object that was returned from facebook checkins search. Which i am glad to say is working like a charm. :)

As to my latest issue, I am glad you put those links up there, because that is what I was finding as well. Guess what I am not seeing is a clear message in any of the links that I have found or documentation that I have read, that clearly says this is what happens when you try to publish a checkin in on the account.

I am getting a 400 error, at least that is what I am seeing, when I dont have it be so friendly. It doesnt tell me anything about whether I have permissions for it or not, and that is what is very frustrating with this one.I can see now why some developers stay away from writing facebook apps for the web, but at the same time, it has been a great challenge. However, now I am at the wall, and not sure what is what in the various documentation I have read.

I have tried calling this both with php and .net (preferred method) and still no luck....so any help you can give me on this is appreciated. :)
0
 

Author Comment

by:JDEE8297
ID: 35228371
This is my token call

https://graph.facebook.com/117222461685581/checkins?access_token=110520359027296|5676c71d774f0f0f934893cd-100002162196933|lKwplOd0Tv5gvvzpUR4Y3hbZ9fc

And this is what is posted
message=fff&place=189676653521&coordinates={"latitude":"42.909184900032","longitude":"-85.508770925153"}

And I send all of this through this code:

 Public Function WebRequests(ByVal method__1 As Method, ByVal url As String, ByVal postData As String) As String

        Dim webRequest As HttpWebRequest = Nothing
        Dim requestWriter As StreamWriter = Nothing
        Dim responseData As String = ""
        'stream.publish
        webRequest = TryCast(System.Net.WebRequest.Create(url), HttpWebRequest)
        webRequest.Method = method__1.ToString()
        webRequest.ServicePoint.Expect100Continue = False
        webRequest.UserAgent = "user_agent"
        webRequest.Timeout = 20000

        If method__1 = Method.POST Then


            Dim encoding As New ASCIIEncoding()
            Dim byte1 As Byte() = encoding.GetBytes(postData)
            webRequest.ContentType = "application/x-www-form-urlencoded"

            ' Set the content length of the string being posted.
            webRequest.ContentLength = byte1.Length

            'POST the data.
            requestWriter = New StreamWriter(webRequest.GetRequestStream())

            Try
                requestWriter.Write(postData)
            Catch ex As WebException
                '_shc.Current.Response.Write(ex.Message & ex.InnerException.ToString)
                Dim readStream As StreamReader = New StreamReader(ex.Response.GetResponseStream())
                _shc.Current.Response.Write("Error " & readStream.ReadToEnd())
            Finally
                requestWriter.Close()
                requestWriter = Nothing
            End Try
        End If

        responseData = WebResponseGet(webRequest)
        webRequest = Nothing
        Return responseData
    End Function

This is the same method I use for sending page posts to facebook, and it has no problems, when I am getting my token I am using the following call:

  Return String.Format("{0}?client_id={1}&redirect_uri={2}", AUTHORIZE, Me.ConsumerKey, strCallBackUrl) & "&scope=publish_stream,publish_checkins,user_checkins,friends_checkins&type=client_cred"

this is what generates the token (i believe) and makes the call back to my call back page.

As I said, I have ran into a wall, as I am not sure what else to do on this. As far as I can see, I have done everything that I possibly can on this, and may be what I am trying to do is not possible in this context of a iframe app in facebook.

Could it be that this is only possible within a facebook app, and not accessible outside of facebook, if that is the case. then how do I get geo location to work in IE like it does in FF. Now I grasphing at straws...:)
0
 

Author Closing Comment

by:JDEE8297
ID: 35238163
I can't remember which link it was, but it was some dotnet code in the link, and as I was looking through my code. I noticed that how they made the call, as oppose to way I was making it.

I was using the profile id of the page, where as they were using me. Made a couple of tweaks and Bob's your uncle and it worked.

So thank you again for your help.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Objective of This Article In 1990’s, when I was a budding software professional, I had a lot of confusion about which stream or technology, I had to choose to build my career. In those days, I had lot of confusion like whether to choose System so…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
The purpose of this video is to demonstrate how to properly insert a Vimeo Video into a WordPress site or Blog. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp…
The purpose of this video is to demonstrate how to manually back up a WordPress Database. This will be demonstrated using a Windows 8 PC. The Host used will be IPage.com Log into your Hosting account. IPage will be used for demonstration : Locat…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question