How-to: Create an API App with Visual Studio
In this how-to I will explain how you can create an API App for your Logic App with Visual Studio.
First we need to install the Microsoft Azure SDK. You need at least version 2.5.1. In this how-to I will install version 2.6
As always I use the Web Platform Installer (nice tool to install frameworks,….)
On the top right you can see a search field. You can put in that Field “Microsoft Azure SDK”. You will get a list with all the
SDK’s possible. Please search for the following item and click on the Add button.
When you clicked on the “Add”. The “Install” button will be clickable.
You will see the following screen. You can just click on the “I Accept” button.
When you installed the SDK, we can start in Visual Studio with creating our API App. We installed the SDK for Visual Studio so we start Visual Studio 2013.
Create a new Project and choose for the “Web”—> “ASP.NET Web Application”.
Then we click on “Azure API App (Preview)”. This will create your new solution.
Then we add a new class to the Models folder.
We create a “ToDo” class.
In that class you can copy past the following.
namespace ToDoApiApp.Models
{
public class ToDo
{
public int Id { get; set; }
public string Description { get; set; }
publicint Priority { get; set; }
}
}
Choose the “Web API 2 Controller – Empty”
Name the controller “ToDoController” and click Add
Now replace the Content of the file with the following. So you will get a List back with your ToDo’s
Just use the shortcut “CTRL + F5”, this will start your API. Append “/swagger” to the url in your browser and you should see something like this.
When you open the “ToDo” part you can see the following.
Now we will click on the “Try It Out” button.
We now see the output. You can see those are the values we provided in the controller.
I hope it’s helping you to create a new API App. If you have any questions, just ping me.
Stay tuned for a new blog post about “Deploying API App to Azure”. In that blog post we will deploy this app to azure.