Feb 18 2012 | 10:58 pm
    Hello folks,
    I thought i might give this a try here. The goal is to ultimately get (some of) the foursquare-api working in max. I've been trying to use processing (as a stepping stone) to connect to the api but to no avail. I've posted on their forum but a lack of response there has led me to a desperate attempt to try it here and have a greater chance at solving this. The more the merrier :)
    The api itself is actually pretty well documented but the focus lies on development for mobile devices and multiple logins. This makes it very hard to filter out what is relevant for me (trying to make a desktop-application without user-login). On top of that it is also introducing some new things i'm not familiar with such as servelts and callback's plus everything is over https which makes it impossible to sniff with wireshark.
    Has anyone here had some experience with Oauth or maybe even foursquare itself? Please by all means share your thoughts/experience/traps.
    Thanks in advance, FRid

    • Feb 19 2012 | 8:51 pm
      Hi FRid,
      I just took a short glance at the foursquare API. It is a so-called REST API, where you execute http POST or GET requests and you will get JSON data back.
      So you need to write some classes that can execute these calls and process the result data.
      Java-SE has currently no JSON library built in, but there are 3rd party libs:
      For the http stuff you will need* (i.e
      and I'd recommend not to execute these http calls in the java main thread as this might make your max-patch being "stuck" if the response takes long.
    • Feb 19 2012 | 9:31 pm
      Hi Jan,
      Thanks for looking into it, appreciate it.
      "where you execute http POST or GET-requests"
      -true, but appeding an accestoken to the request is mandatory for most (interesting:) calls and getting that token is the cullprit because you only get that after some mumbo-jumbo Oauth-stuff.
      I've actually gotten a little further by taking a few steps back. Instead of using the 4square java-wrappers i decided to handle the Oauth first because the api-calls are indeed just Get_request_method's.
      Anyway thanks again and i'll keep the threads in mind!
    • Feb 19 2012 | 9:48 pm
      Hi FRid,
      I found this maybe it helps:
      If I understand it right you just need to register and obtain your credentials (client_id and secret)that will be hard coded into your class and than you can execute the login via API. j
    • Feb 19 2012 | 10:36 pm
      Thanks for the link but i have been draining google for the past few days for examples and everytime it seems hopefull it seems to hang on some missing class, unknown method or java.lang.exception. Plus half the time i'm translating from android to java while i'm too noob for that so i'm a bit done with all those examples (not that i don't appreciate the link ofcourse :). I guess that's the most frustrating part, seeing those examples, people's thankfull reactions to it and then only to discover it doesn't work (for me). Well, let's say it's not really boosting the moral.
      That is why i am glad to have found the scribe Oauth-library. Much simpler and much more logical too, instead of building a dedicated client for every api it is a framework which can be expanded to any Oauth-relying api (i believe). The scribe-library has gotten me the furthest so far, i'm getting an error about "uri_rediecting_mismatch" but i think after this i'll finally be able to get the accestoken.