Azure Web API Access: Which URL should I use, the Web Service URL or Gateway URL?

Viewed 446

I uploaded an App Service in Azure, already with working API (with JWT Token system). It's all fine and working with <mywebapp>.azurewebsites.net (Web Service URL) for the front-end website, and <mywebapp>.azurewebsites.net/<api-route> for API access.

And then I've read about API Management Services so I registered my web app though there. Now I can use the portal to test my API, it even has its own token system, but my JWT token system is still in effect, so now I would need to do 2 authorization methods to use this API? I've also got a new domain: <mywebapp>.azure-api.net/<api-route> (Gateway URL) which now created the confusion.

My question is, is it okay to just use the same web app as front-end and API, like what I did in the App Service example? Or is it more pretty to create a separate web app to use in API Management Services (and use the default token system)?

I created my front-end with Razor using this tutorial: https://docs.microsoft.com/en-us/aspnet/core/tutorials/razor-pages/?view=aspnetcore-5.0

And then I added the API on top of it using this tutorial: https://docs.microsoft.com/en-us/aspnet/core/tutorials/first-web-api?view=aspnetcore-5.0&tabs=visual-studio

1 Answers

For your scenario since you only have one API, you can directly call the API endpoint from the Web App and completely get rid of the APIM. I do not see a need for APIM here.

APIM helps if you have multiple apis and you want to abstract all of them under one URL so that your frontend Web layer doesn't have to remember multiple API urls.

For example, if you have 3 different API URL then you can abstract all under one APIM URL like below-

apimurl.azure-api.net
     -- api1url.azurewebsites.net/hr
     -- api2url.azurewebsites.net/finance
     -- api3url.azurewebsites.net/payroll

Then your Web UI just can call apimurl.azure-api.net/hr or apimurl.azure-api.net/finance

For your case make it simple and go with App Service URL. If you want to test your API just use Swagger UI.

Related