Windows | Linux | OS X |
---|---|---|
1️⃣ Location Api Client. 📜 https://developer.accuweather.com/accuweather-locations-api/apis
2️⃣ Current Conditions Api Client. 📜 https://developer.accuweather.com/accuweather-current-conditions-api/apis
3️⃣ Forecast Api Client. 📜 https://developer.accuweather.com/accuweather-forecast-api/apis
4️⃣ Indices Api Client. 📜 https://developer.accuweather.com/accuweather-indices-api/apis
Accuweather Api Client is available on NuGet.
using Accuweather;
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
services.AddSingleton<IAccuweatherApi>(l => new AccuweatherApi("YOUR_API_KEY", "en-us");
}
}
using Accuweather;
public class SampleController : Controller
{
private readonly IAccuweatherApi _accuweatherApi;
public void SampleController(ILocationsApi accuweatherApi)
{
_accuweatherApi = accuweatherApi;
}
public async Tasnk<ActionResult> GetRegionList()
{
var regionList = await _accuweatherApi.Locations.GetRegionList();
return Json(regionList , JsonRequestBehavior.AllowGet);
}
}