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

How to consume an external api rest?

$
0
0

I need to consume a Rest API from an ERP Site, where I will list some items from this site, but I do not find anything useful that can help me to consume

I am using json and http client to perform, but the error in the process recognize the site path

public partial class ProdutoPage : ContentPage
    {
        ListView lv = new ListView();
        public ProdutoPage()
        {
            InitializeComponent();
            iniciar();
        }
        private async void  iniciar()
        {
            //tinyapp API = new tinyapp();

            //var lista = API.ListaCategorias("automacao");


            var client = new HttpClient();
            client.DefaultRequestHeaders.Add("token", "");
            client.BaseAddress = new Uri("site");
            var resp = await client.GetAsync("site");

            if (resp.IsSuccessStatusCode)
            {
                var respStr = await resp.Content.ReadAsStringAsync();
                var l = JsonConvert.DeserializeObject<List<Pedido>>(respStr);
                lv.ItemsSource = l;
            }
        }
    }
}

I need a list of ERP site requests


Viewing all articles
Browse latest Browse all 91519

Trending Articles



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