Solved

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

Posted on 2011-03-25
10
819 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
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 
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

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

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

Suggested Solutions

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
When setting up new project requests for our site, one of the most powerful tools our team has available to use is Axure (http://www.axure.com/). It’s a tool for creating software and web prototypes that can function and interact as if it were the a…
The purpose of this video is to demonstrate how to set up basic WordPress SEO. This will be demonstrated using a Windows 8 PC. The plugin used will be WordPress SEO by Yoast. Go to your WordPress login page. This will look like the following: myw…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

773 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