How To Use API Apps In Azure

Introduction 

In this article you’ll learn how to use API Apps from the Azure portal to host your RESTful APIs and the data live. Before understanding or using API Apps in Azurejust go through the actual benefits of App Services.

service

To use API Apps services from Azure, first create your rest service. Open your Visual Studio and create a web application with Web API references.

references

Select a template with Web API to get a default ready made API controller by Visual Studio with the name “ValuesController”.

ValuesController

This is your ready made solution for API in Visual Studio with a Values name Controller.

Controller

There is an httpGet method for testing. So, I am not going to make a new one because I can test this only.

method

If I run this on localhost the  first time you’ll get exception because your default API controller is having an Authorize attribute. So if you want just testing, go to controller file.

localhost

Now remove this, without removing it you have to authorize for this application.

application

Now if you run your application, you’ll get your data from values controller as XML document.

XML

Now login with your account and follow the below given steps.

account

Click on New, Web + Mobile, then API App.

API App

Just fill the details for your API to make a space at azure with the application name.

application

After clicking on Create button you will get notification for success.

notification

Now you can see your API App service in Dashboard.

Dashboard

If you want to see more details, just click on the name of API app Service.

Service

Now just go to your solution in Visual Studio and right click on application name, then find Publish.

Publish

Select Microsoft Azure API Apps .

Apps

Click on next or publish and login with your Azure Account in Visual Studio.

Visual Studio

Visual Studio

Now you can find your already created APIs or you can create new directly from Visual Studio without using Azure Portal.

Portal

After that, I’ll get all DNS or FTP details and allow you to publish.

publish

Now just click on publish and browse this into browser, you’ll get your API data.

API

I hope you enjoyed this article. Stay tuned with me for more articles on Azure and other Microsoft technologies.

Thanks.

Connect (“Nitin Pandit”);

Read more articles on Azure: