Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2011-03-25
10
Medium Priority
?
825 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Plesk WordPress Toolkit

Plesk's WordPress Toolkit allows server administrators, resellers and customers to manage their WordPress instances, enabling a variety of development workflows for WordPress admins of all skill levels, from beginners to pros.

See why 2/3 of Plesk servers use it.

 
LVL 82

Expert Comment

by:leakim971
ID: 35228010
0
 
LVL 82

Accepted Solution

by:
leakim971 earned 2000 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

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

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

Introduction In this tutorial, I'll explain how to create an animated progress meter in a wireframe prototype developed using Axure RP 7.0 - a leading prototyping tool for designing web sites and software. (For more information about Axure and gett…
This article discusses how to implement server side field validation and display customized error messages to the client.
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 integrate Mailchimp with Facebook. This will be demonstrated using a Windows 8 PC. Mailchimp and Facebook will be used. Log into your Mailchimp account. : Click on your name. Go to Account Setti…
Suggested Courses

618 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