Configuring Raspberry Pi with Windows 10 IoT App using Rest API

+1 vote

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,270 points
937 views

1 answer to this question.

+1 vote

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,240 points
hank you so much for this. I was into this issue and tired to   tinker around to check if its possible but couldnt get it done. Now that i have seen the way you did it, thanks guys
with
regards

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,240 points
997 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 10, 2018 in IoT (Internet of Things) by nirvana
• 3,130 points
1,553 views
0 votes
1 answer

Autostart published Application on Windows 10 IoT

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

answered Jul 13, 2018 in IoT (Internet of Things) by DataKing99
• 8,250 points
1,793 views
0 votes
1 answer
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,620 points
3,170 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,240 points
1,188 views
0 votes
1 answer
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP