Foursquare–part 1 of 4

I have decided to log my daily routine from FourSquare .  I decided to make a Web application and a desktop application ( console, to be easiear) .

As a good application, 4Sq have an API at https://developer.foursquare.com/ . I suggest you to start with conecting to 4Sq, https://developer.foursquare.com/overview/auth .

For WebServers , you will redirect the user to  an URL from 4Sq.

https://foursquare.com/oauth2/authenticate
    ?client_id=YOUR_CLIENT_ID
    &response_type=code
    &redirect_uri=YOUR_REGISTERED_REDIRECT_URI

The user gives his accept to use your application and 4Sq redirects the browser back to YOUR_REGISTERED_REDIRECT_URI

Then , with the code, you can ask for an access token and then you can search 4Sq API.

I have searched also a 4Sq application in .NET   – and I found this one : https://github.com/ignatandrei/SharpSquare

Ok, so for implementing with ASP.NET MVC it is relatively simple – I must make an action that can answer to YOUR_REGISTERED_REDIRECT_URI and then ask for user checklist for the previous day – rather simple:

 public ActionResult oldWay(string id)
        {
            var c = new conect4Sq();
            c.SetAccessCode(id);
            var data = c.CheckinsYesterday();
            return View("~/Views/Home/ShowCheckins.cshtml",data);//TODO: use T4MVC

        }

You can see the application in work at http://fsq.apphb.com/  – just press the first “learn more” from the left.

You will find  the source code at https://github.com/ignatandrei/4SqDayHistory

Problem solved !

Now the real problem is to do the same thing from a DESKTOP application ( or Console, to be easier) – but this will be in the second part next week!