c# - Calling a rest API windows 10 IoT with a Raspberri pi -
i'm trying simple calling rest api using universal app windows 10 iot can't find way it.
normally use:
private xelement importdata(string sourceurl) { webclient wc = new webclient(); string source = wc.downloadstring(sourceurl); return xelement.parse(source, loadoptions.none); }
but isn't available.
you should use httpclient instead of webclient. try this
httpclient client = new httpclient(); string url = "url here"; httpresponsemessage response = await client.getasync(url); return response.content.readasstring();
Comments
Post a Comment