Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 77050

Test local API. Which adress to connect Mobile App whith API?

$
0
0

I created a REST api project and a xamarin.forms project. now I'm trying to verify locally (the same computer) if xamarin.forms correctly receives the data.
To find the data I use this address successfully: http: // localhost: 62500 / api / users /
To call the data within the APP (reading in the various forums) I should change the address replacing it with that of the computer. I also modified the 'applicationhost' file by entering the string ''
I tried http://192.168.1.184:62500/api/utenti/ but I returned a statuscode of 400 (bad request).
I tried http://192.168.1.184/api/utenti/ but the APP remains frozen until it generates an error and closes.

the code I use is:

var response = await _client.GetAsync("http://192.168.1.184:62500/api/utenti/"); if (response.IsSuccessStatusCode) { var content = await response.Content.ReadAsStringAsync(); var ob = JsonConvert.DeserializeObject(content); await DisplayAlert("data", content, "ok"); } else { await DisplayAlert("data", "Errore dati!", "ok"); }

where am I wrong?
thanks


Viewing all articles
Browse latest Browse all 77050

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>