Solved

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

Posted on 2011-03-25
10
817 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
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The purpose of this video is to demonstrate how to create a Printer Friendly PDF on a WordPress Page. This will be demonstrated using a Windows 8 PC. Tools Used are Photoshop, Awesome Screenshot” Google Chrome Extension, and SmallPDF.com Log…
The purpose of this video is to demonstrate how to Test the speed of a WordPress Website. Site Speed is an important metric of a site’s health. Slow site speed can result in viewers leaving your site quickly and not seeing your content. This…

762 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

17 Experts available now in Live!

Get 1:1 Help Now