REST API Example Solution


Nearly every project finds a need to integrate various pieces of software and systems.  We know this and that is why we have made sure to not only provide you with a robust and lightweight API, but we made sure that you had a sample project at your fingertips to get you started.


The following is required to accomplish the goals of this article:

  • How to use Visual Studio 2012 or newer
  • Understanding of REST, AJAX, and APIs
  • Have a site with Hotcakes Commerce installed and ready

Getting Started

You are about to use a Visual Studio project to connect to your Hotcakes Commerce store.  The project can be downloaded on the right.  The documentation below will walk you through how to use this project.

Make sure you have a development website ready to accept API calls from your project.  This would consist of the DNN CMS and Hotcakes Commerce.  Also, if you do not already have products in your store, you should consider adding some or adding the sample products.  This could even be a restored back-up of your production website.

REST API Sample Project

If you haven’t done so already, make sure your site is up and running and ready for your API project to call into it.  It will be necessary to have two pieces of information, the API path for your site and an API key.  The API key can be generated in the store admin area.

We are about to have you set up your project.  Once you understand how this works, feel free to set up your project and solution in any way that works for you.  Also, please do not do this development work on your production website.

Open the download from above using your favorite zip utility.  Grab all of the files from the zip archive and unzip them into the root of your development site.

Drag and drop the project files into your Hotcakes development site folder

If you receive any prompts from Windows, it’s likely that you already have a set of Hotcakes project files added to your development site.  Go ahead and overwrite the files.  This should result with the API Samples, References, and ApiSample.sln folders and files in your DNN folder like shown below.

Copied files and folders in the destination folder

Next, open the solution that is now in the root of your website.  Double-clicking on it will do the trick.  This will open Visual Studio and show your project open.  Your Solution Explorer view should look similar to the image below.

Sample API project files in Visual Studio solution explorer

This is a console application.  If you’re not familiar with console applications, they are very useful to build a proof of concept code sample and especially to make it fast and easy to build something that you can use to troubleshoot API’s that you’re not familiar with.

At this point, you already have a working project that you can use to build code samples for your real project, whatever it may be.  You have two examples for your convenience.  In both files, it will be necessary for you to first change the domain name and API key values in the code in order for it to work.

Changes needed in the code samples

  • ApiSample.htm – This is a real working example of how to access the REST API using client-side AJAX calls.  This file can be used in your website, but with it being a client-side call, web browsers require that the API you reference be on the same domain as where the file lives.
  • Program.cs – This is a server-side example of accessing the REST API using C#.  To see the results and debug, simply build the project and you will see the results in a command window.

The two screenshots below should be similar to what you see when you run the code samples, assuming that you have products and categories in your store.

Client-side API example succeeded

Server-side API example succeeded

From this point forward, just adjust the code samples as you need to in order to build your own applications to integrate with your Hotcakes Commerce store.

Have more questions? Submit a request

Need More Help?

Do you need more assistance with this article? Please review your support options.