I'm completely new to all of this, but I'm trying to write something in C# (using visual studio) that will get weather data for me. I only need the daily high/low temps, and there are plenty of weather websites that offer free APIs that provide that information. The problem is, I don't have any idea how to use an API to get my data, or even what that means, really. I'm just looking for a small example of how I would input a url or API key or whatever I need, and how the data would be returned back to me/how I could then put it into a list or something use it in the rest of my program. I know this is a pretty broad question and maybe this is the wrong place to ask it, but if anyone has some ideas for me, that'd be great. I've read several "simple API" tutorials that didn't make any sense to me.
To get data from an API you won't need much. Something like
using(WebClient client = new WebClient())
{
// Download the data
string value = client.DownloadString("http://dev.theapi.com?key=<yourkey>&state=california");
}
The API key will most likely just be added as a parameter in your url. The data you get back will typically be in JSON or XML format. You can then just deserialize the data back into C# classes. If you have your url you can also just put it in a browser and it should return the same data so you easily see what structure you have. Most API providers will have either libraries which will save you doing the grunt work and just return nice objects for you or they will have simply have examples of the URL's to call and the data to expect back.
Hope that gets you started. This is pretty generalised obviously.