Where do I put my api so I can consume it from my Xamarin.Forms application?

I have developed a REST api for my mobile application that "reaches into" my external SQL Server DB and makes whatever information that is requested available in JSON format. This api needs to go onto another server but I'm not exactly sure where to place it, how to place it, or what to do to ensure this information is available for consumption from my Xamarin.Forms application.


  • NMackayNMackay GBInsider, University mod


    I'd recommend defining an interface you can inject into your view models and consume.

     public SearchViewModel(INavService nav, IDialogService dlg, IExceptionService ex, IOrderDataService orders)
                _navService = nav;
                _dialog = dlg;
                _exService = ex;
                _orderService = orders;

    Register it in your IoC at startup. If your consuming two different endpoints then a service layer for each would make sense.

  • @NMackay where do I physically place this file on my server and how do I make it accessible?

  • NMackayNMackay GBInsider, University mod
    edited September 2016


    I thought you meant in the app.

    You'd need to host your service in an public facing web server that your phone can hit, assuming you've developed a WCF restful service or a WebAPI service then you can host it in IIS7 etc if your using 2008/2012 server.

    Here's a link to help you get started but this is really the wrong forum for this kind of question


    If your transferring sensitive information you really need to bind to HTTPS and provide a certificate.

Sign In or Register to comment.