Configuring Raspberry Pi with Windows 10 IoT App using Rest API

0 votes

I'm trying to do something as simple as calling a REST API using an universal app for windows 10 IoT but I can't find a way to do it.

Normally I would use:

private XElement ImportData(string sourceUrl)
    {

        WebClient wc = new WebClient();

        String source = wc.DownloadString(sourceUrl);
        return XElement.Parse(source, LoadOptions.None);

    }

but it isn't available.

Oct 10, 2018 in IoT (Internet of Things) by Matt
• 2,260 points
82 views

1 answer to this question.

0 votes

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();
answered Oct 10, 2018 by anonymous2
• 4,260 points

Related Questions In IoT (Internet of Things)

0 votes
1 answer
0 votes
1 answer

Configuring a Windows 10 IoT App for Automatic Restart

Have you tried using powershell right after ...READ MORE

answered Oct 10, 2018 in IoT (Internet of Things) by anonymous2
• 4,260 points
42 views
0 votes
1 answer

Display time in a Windows Core IoT app with a clock!

It is possible, but you should understand ...READ MORE

answered Jul 9, 2018 in IoT (Internet of Things) by nirvana
• 3,060 points
97 views
0 votes
1 answer

Autostart published Application on Windows 10 IoT

It can be done by making changes ...READ MORE

answered Jul 12, 2018 in IoT (Internet of Things) by DataKing99
• 8,130 points
127 views
0 votes
1 answer

How to deploy Windows 10 IoT (Rasp Pi image) as a Virtual Machine

The easiest way I found is downloading ...READ MORE

answered Sep 10, 2018 in IoT (Internet of Things) by Upasana
• 8,530 points
186 views
0 votes
1 answer

Windows 10 IoT Raspberry Pi 2: DHT22/AM2302

DHT22 requires very precise timing. Although Raspberry ...READ MORE

answered Oct 29, 2018 in IoT (Internet of Things) by anonymous2
• 4,260 points
90 views
0 votes
1 answer
0 votes
1 answer