Solved

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

Posted on 2011-03-25
10
818 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
 
LVL 82

Expert Comment

by:leakim971
ID: 35228010
0
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The purpose of this video is to demonstrate how to integrate Mailchimp with WordPress, by placing a Mailchimp signup form on a WordPress Page or Post. This will be demonstrated using a Windows 8 PC. Mailchimp will be used. Log into your Mailchi…
The purpose of this video is to demonstrate how to set up the permalinks on a WordPress Website. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp-login.php : Go t…

919 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now