Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Azure API App how to use single hosted api for both Mobile and Web

This question is related to following questions but not the same question

How can i integrate Azure Mobile App win Azure API app

How to combine azure AppServices API, Mobile and Web apps

I have been trying to setup an API to use with my mobile app(Xamarin) and Web app(Angular or ASP.NET MVC). I wanted to use "Azure App Service". As i understand there are three things in Azure app service

  1. Web Apps
  2. Mobile Apps
  3. API Apps

I wanted to select the "API APPS" as i wanted to use my Existing ASP.Net Web Api and wanted to expose the Api to swagger. Also I wanted to share this api with Mobile app as well as Web App.

Based on the documentation "API APPS" can be consumed by Mobile and Web clients.Web client is OK but i need to use Azure Mobile features(such as Single Authentications,Notifications,Offline Sync with Sql lite and etc ) to make things easy in Mobile app.

As per answers for above questions and the documentation, i can install mobile app back-end packages to ASP.Web API and host it as "Mobile APPS". So i can use all the features related to mobile.

  1. My problem if i install the mobile back-end, can i use the same API for Web Front end? Because I am hosting it as "Mobile APPS" service not the "API APPS" service.

  2. How can I share a single API host with mobile client (With Mobile back end feature) and Web client?

  3. Is it possible to install the Mobile back-end packages and host the API as "API APPS" , then use Mobile SDK in Xamarin app and the HTTP client or other client in Web APP to consume the same API?

like image 375
Thabo Avatar asked Aug 20 '16 22:08

Thabo


People also ask

What is the difference between Azure Web App and Azure App Service?

There is no difference. To quote the documentation: The only difference between the three app types (API, web, mobile) is the name and icon used for them in the Azure portal. Behind the scene it is already using app service all the time.

What is the relationship between an Azure app service plan and an azure web app?

An App Service plan defines a set of compute resources for a web app to run. These compute resources are analogous to the server farm in conventional web hosting. One or more apps can be configured to run on the same computing resources (or in the same App Service plan).


1 Answers

If you want to use the Azure Mobile client SDK, especially features like offline sync, then you need to use the Azure Mobile server SDK. It's a set of NuGet packages that simply extend ASP.NET Web API.

If you want to roll your own mobile client, or just use the authentication feature, then you don't need to use the Azure Mobile server SDK and you can use just Web API.

If you do want to use the server SDK, we have samples that show how to consume this TableController API from a web client:

  • https://github.com/azure-appservice-samples/contosomoments

  • Azure App Service field engineer sample with web admin portal and offline-sync-enabled Xamarin.Forms client

like image 163
lindydonna Avatar answered Sep 24 '22 21:09

lindydonna