Monotouch consumes ASP.NET Web Api

I have a Monotouch project that uses WCF web services today to retrieve data. Now I want to port it to start using ASP.NET Web Api Json.

Does anyone know how I can send viewmodel data from ASP.NET Web Api and then read it in monotouch?

Thanks for the help in advance.

+4
source share
1 answer

I think you should read this Xamarin article.

In general, the Web API is just an HTTP protocol that passes XML or JSON back and forth. It is not necessary that the client infrastructure access it - you can use it with raw HttpWebRequests or the equivalent depending on which programming language you use.

Given that your options are:

  • Use an open source library to do this (something like RestSharp )
  • Create HttpWebRequest calls and format the XML or JSON for requests and responses yourself (you can use .Net BCL to execute this or other open source projects)

I usually do the first, simply because I like the fine-grained control over what happens. # 1 might be easier for you.

+2
source

Source: https://habr.com/ru/post/1435949/


All Articles