Introduction

Microsoft WebMatrix provides an easy way to get started with web development, and together with new Razor syntax for ASP.NET Web Pages it includes everything you need to get your web site up, running and integrated with many other sites and networks, in a short period of time. The WebMatrix helpers are designed to make your life easier when creating web sites. They provide you a simple and consistent way of performing common web development tasks that otherwise would require a great deal of custom coding. With a few lines of code you should be able to secure your web site using membership, store information in Windows Azure Storage, integrate your site with Facebook, among others things.

The Groupon Helper for WebMatrix allows you to easily add a Groupon badge to your WebMatrix site. When the helper is in place, it can query the Groupon API to get the deals for a given location, for you to display them in new, different ways.

groupon-helper

Getting Started in 60 Seconds

The helper mainly consists of a Groupon.cs file, that should be placed in the App_Code folder of your WebMatrix site, together with a Groupon folder with helper functions. To use the helper follow these steps:

  1. If you haven't got an Groupon account, sign up first.
  2. Once logged in, browse to the Groupon API Home Page, click the Get My API Key button and make note of its value.
  3. Download the helper package and extract its content in the root folder of your WebMatrix site.
  4. Add the following line to the _AppStart.cshtml page of your WebMatrix site, replacing the placeholders with your Groupon API key (optionally, you can also provide your referral code).
    @{
        Groupon.Initialize(apiKey: "{your-api-key}");  
    }
  5. In any WebMatrix page, add the following line to display the Groupon daily deal:
    @Groupon.GetDailyDealWidget(city: "miami")

Documentation and Samples

Helper reference is available here. Optionally, you can download a sample WebMatrix web site where you can see the helper in action. It contains an example of how to use the helper together with the Bing Maps API, to display deals over a map. To download and run it with Microsoft WebMatrix, follow these steps:

  1. Download the sample site from Downloads section. Extract the contents and open the folder in WebMatrix.
  2. Configure your Groupon API key in the _AppStart.cshtml page.
  3. Run the sample! It contains code samples and examples of each feature provided by the helper.

Other Useful Resources

Don't miss the helper's getting started screencast.

You can find more information about the Groupon API in http://sites.google.com/site/grouponapiv2/home.

Learn more on WebMatrix, ASP.NET Web Pages and the Razor Syntax with the WebMatrix tutorials

Last edited Dec 29, 2010 at 1:44 PM by jsenior, version 6