Weather API from Mashape

AirQuality

getAqi

Gets the air quality index

Air quality is a measure of air pollution. The higher the number, the worse the pollution.


/aqi

Usage and SDK Samples


curl -X get -H "X-Mashape-Key: [[apiKey]]"  "https://simple-weather.p.mashape.com/aqi?lat=&lng="



import io.swagger.client.*;
import io.swagger.client.auth.*;
import io.swagger.client.model.*;
import .AirQualityApi;

import java.io.File;
import java.util.*;

public class AirQualityApiExample {

    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();

        // Configure API key authorization: api_key
        ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key");
        api_key.setApiKey("YOUR API KEY");
        // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
        //api_key.setApiKeyPrefix("Token");

        AirQualityApi apiInstance = new AirQualityApi();
        String lat = lat_example; // String | latitude
        String lng = lng_example; // String | longitude
        try {
            aqiResponse result = apiInstance.getAqi(lat, lng);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AirQualityApi#getAqi");
            e.printStackTrace();
        }
    }
}

                                                  

import .AirQualityApi;

public class AirQualityApiExample {

    public static void main(String[] args) {
        AirQualityApi apiInstance = new AirQualityApi();
        String lat = lat_example; // String | latitude
        String lng = lng_example; // String | longitude
        try {
            aqiResponse result = apiInstance.getAqi(lat, lng);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AirQualityApi#getAqi");
            e.printStackTrace();
        }
    }
}

                                                  

Configuration *apiConfig = [Configuration sharedConfig];

// Configure API key authorization: (authentication scheme: api_key)
[apiConfig setApiKey:@"YOUR_API_KEY" forApiKeyIdentifier:@"X-Mashape-Key"];
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//[apiConfig setApiKeyPrefix:@"Bearer" forApiKeyIdentifier:@"X-Mashape-Key"];


String *lat = lat_example; // latitude
String *lng = lng_example; // longitude

AirQualityApi *apiInstance = [[AirQualityApi alloc] init];

// Gets the air quality index
[apiInstance getAqiWith:lat
    lng:lng
              completionHandler: ^(aqiResponse output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];

                                                    

var  = require('');
var defaultClient = .ApiClient.instance;

// Configure API key authorization: api_key
var api_key = defaultClient.authentications['api_key'];
api_key.apiKey = "YOUR API KEY"
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//api_key.apiKeyPrefix['X-Mashape-Key'] = "Token"

var api = new .AirQualityApi()

var lat = lat_example; // {String} latitude

var lng = lng_example; // {String} longitude


var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
api.getAqi(lat, lng, callback);

                                                    

using System;
using System.Diagnostics;
using .Api;
using .Client;
using ;

namespace Example
{
    public class getAqiExample
    {
        public void main()
        {

            // Configure API key authorization: api_key
            Configuration.Default.ApiKey.Add("X-Mashape-Key", "YOUR_API_KEY");
            // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
            // Configuration.Default.ApiKeyPrefix.Add("X-Mashape-Key", "Bearer");

            var apiInstance = new AirQualityApi();
            var lat = lat_example;  // String | latitude
            var lng = lng_example;  // String | longitude

            try
            {
                // Gets the air quality index
                aqiResponse result = apiInstance.getAqi(lat, lng);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AirQualityApi.getAqi: " + e.Message );
            }
        }
    }
}

                                                    

setApiKey('X-Mashape-Key', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// io.swagger.client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Mashape-Key', 'Bearer');

$api_instance = new io.swagger.client\Api\AirQualityApi();
$lat = lat_example; // String | latitude
$lng = lng_example; // String | longitude

try {
    $result = $api_instance->getAqi($lat, $lng);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling AirQualityApi->getAqi: ', $e->getMessage(), PHP_EOL;
}

                                                  

Parameters

Query parameters
Name Description
lat*
lng*

Responses

Status: 200 - AQI response

52

WeatherData

getWeatherData

Get weather forecast with lots of details

Includes full details of the weather forecast, in JSON format


/weatherdata

Usage and SDK Samples


curl -X get -H "X-Mashape-Key: [[apiKey]]"  "https://simple-weather.p.mashape.com/weatherdata?lat=&lng="



import io.swagger.client.*;
import io.swagger.client.auth.*;
import io.swagger.client.model.*;
import .WeatherDataApi;

import java.io.File;
import java.util.*;

public class WeatherDataApiExample {

    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();

        // Configure API key authorization: api_key
        ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key");
        api_key.setApiKey("YOUR API KEY");
        // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
        //api_key.setApiKeyPrefix("Token");

        WeatherDataApi apiInstance = new WeatherDataApi();
        String lat = lat_example; // String | latitude
        String lng = lng_example; // String | longitude
        try {
            weatherdata response result = apiInstance.getWeatherData(lat, lng);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling WeatherDataApi#getWeatherData");
            e.printStackTrace();
        }
    }
}

                                                  

import .WeatherDataApi;

public class WeatherDataApiExample {

    public static void main(String[] args) {
        WeatherDataApi apiInstance = new WeatherDataApi();
        String lat = lat_example; // String | latitude
        String lng = lng_example; // String | longitude
        try {
            weatherdata response result = apiInstance.getWeatherData(lat, lng);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling WeatherDataApi#getWeatherData");
            e.printStackTrace();
        }
    }
}

                                                  

Configuration *apiConfig = [Configuration sharedConfig];

// Configure API key authorization: (authentication scheme: api_key)
[apiConfig setApiKey:@"YOUR_API_KEY" forApiKeyIdentifier:@"X-Mashape-Key"];
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//[apiConfig setApiKeyPrefix:@"Bearer" forApiKeyIdentifier:@"X-Mashape-Key"];


String *lat = lat_example; // latitude
String *lng = lng_example; // longitude

WeatherDataApi *apiInstance = [[WeatherDataApi alloc] init];

// Get weather forecast with lots of details
[apiInstance getWeatherDataWith:lat
    lng:lng
              completionHandler: ^(weatherdata response output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];

                                                    

var  = require('');
var defaultClient = .ApiClient.instance;

// Configure API key authorization: api_key
var api_key = defaultClient.authentications['api_key'];
api_key.apiKey = "YOUR API KEY"
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//api_key.apiKeyPrefix['X-Mashape-Key'] = "Token"

var api = new .WeatherDataApi()

var lat = lat_example; // {String} latitude

var lng = lng_example; // {String} longitude


var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
api.getWeatherData(lat, lng, callback);

                                                    

using System;
using System.Diagnostics;
using .Api;
using .Client;
using ;

namespace Example
{
    public class getWeatherDataExample
    {
        public void main()
        {

            // Configure API key authorization: api_key
            Configuration.Default.ApiKey.Add("X-Mashape-Key", "YOUR_API_KEY");
            // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
            // Configuration.Default.ApiKeyPrefix.Add("X-Mashape-Key", "Bearer");

            var apiInstance = new WeatherDataApi();
            var lat = lat_example;  // String | latitude
            var lng = lng_example;  // String | longitude

            try
            {
                // Get weather forecast with lots of details
                weatherdata response result = apiInstance.getWeatherData(lat, lng);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling WeatherDataApi.getWeatherData: " + e.Message );
            }
        }
    }
}

                                                    

setApiKey('X-Mashape-Key', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// io.swagger.client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Mashape-Key', 'Bearer');

$api_instance = new io.swagger.client\Api\WeatherDataApi();
$lat = lat_example; // String | latitude
$lng = lng_example; // String | longitude

try {
    $result = $api_instance->getWeatherData($lat, $lng);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling WeatherDataApi->getWeatherData: ', $e->getMessage(), PHP_EOL;
}

                                                  

Parameters

Query parameters
Name Description
lat*
lng*

Responses

Status: 200 - Successful operation

{query={count=1, created=2017-06-24T23:47:36Z, lang=en-US, results={channel={units={distance=km, pressure=mb, speed=km/h, temperature=C}, title=Yahoo! Weather - Sunnyvale, CA, US, link=http://us.rd.yahoo.com/dailynews/rss/weather/Country__Country/*https://weather.yahoo.com/country/state/city-91990359/, description=Yahoo! Weather for Sunnyvale, CA, US, language=en-us, lastBuildDate=Sat, 24 Jun 2017 04:47 PM PDT, ttl=60, location={city=Sunnyvale, country=United States, region= CA}, wind={chill=73, direction=345, speed=28.97}, atmosphere={humidity=64, pressure=34033.22, rising=0, visibility=25.91}, astronomy={sunrise=5:48 am, sunset=8:33 pm}, image={title=Yahoo! Weather, width=142, height=18, link=http://weather.yahoo.com, url=http://l.yimg.com/a/i/brand/purplelogo//uh/us/news-wea.gif}, item={title=Conditions for Sunnyvale, CA, US at 04:00 PM PDT, lat=37.377499, long=-122.04686, link=http://us.rd.yahoo.com/dailynews/rss/weather/Country__Country/*https://weather.yahoo.com/country/state/city-91990359/, pubDate=Sat, 24 Jun 2017 04:00 PM PDT, condition={code=28, date=Sat, 24 Jun 2017 04:00 PM PDT, temp=22, text=Mostly Cloudy}, forecast=[{code=28, date=24 Jun 2017, day=Sat, high=25, low=16, text=Mostly Cloudy}, {code=30, date=25 Jun 2017, day=Sun, high=25, low=15, text=Partly Cloudy}, {code=30, date=26 Jun 2017, day=Mon, high=22, low=14, text=Partly Cloudy}, {code=30, date=27 Jun 2017, day=Tue, high=23, low=15, text=Partly Cloudy}, {code=34, date=28 Jun 2017, day=Wed, high=25, low=13, text=Mostly Sunny}, {code=30, date=29 Jun 2017, day=Thu, high=25, low=13, text=Partly Cloudy}, {code=34, date=30 Jun 2017, day=Fri, high=25, low=13, text=Mostly Sunny}, {code=30, date=01 Jul 2017, day=Sat, high=25, low=14, text=Partly Cloudy}, {code=30, date=02 Jul 2017, day=Sun, high=25, low=14, text=Partly Cloudy}, {code=30, date=03 Jul 2017, day=Mon, high=23, low=15, text=Partly Cloudy}], description=<![CDATA[<img src="http://l.yimg.com/a/i/us/we/52/28.gif"/>
<BR />
<b>Current Conditions:</b>
<BR />Mostly Cloudy
<BR />
<BR />
<b>Forecast:</b>
<BR /> Sat - Mostly Cloudy. High: 25Low: 16
<BR /> Sun - Partly Cloudy. High: 25Low: 15
<BR /> Mon - Partly Cloudy. High: 22Low: 14
<BR /> Tue - Partly Cloudy. High: 23Low: 15
<BR /> Wed - Mostly Sunny. High: 25Low: 13
<BR />
<BR />
<a href="http://us.rd.yahoo.com/dailynews/rss/weather/Country__Country/*https://weather.yahoo.com/country/state/city-91990359/">Full Forecast at Yahoo! Weather</a>
<BR />
<BR />
(provided by <a href="http://www.weather.com" >The Weather Channel</a>)
<BR />
]]>, guid={isPermaLink=false}}}}}}

WeatherForecast

getWeather

Gets the weather forecast in abbreviated form

retrieves the weather forecast, but without too much detail


/weather

Usage and SDK Samples


curl -X get -H "X-Mashape-Key: [[apiKey]]"  "https://simple-weather.p.mashape.com/weather?lat=&lng="



import io.swagger.client.*;
import io.swagger.client.auth.*;
import io.swagger.client.model.*;
import .WeatherForecastApi;

import java.io.File;
import java.util.*;

public class WeatherForecastApiExample {

    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();

        // Configure API key authorization: api_key
        ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key");
        api_key.setApiKey("YOUR API KEY");
        // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
        //api_key.setApiKeyPrefix("Token");

        WeatherForecastApi apiInstance = new WeatherForecastApi();
        String lat = lat_example; // String | latitude coordinates
        String lng = lng_example; // String | longitude coordinates
        try {
            weatherResponse result = apiInstance.getWeather(lat, lng);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling WeatherForecastApi#getWeather");
            e.printStackTrace();
        }
    }
}

                                                  

import .WeatherForecastApi;

public class WeatherForecastApiExample {

    public static void main(String[] args) {
        WeatherForecastApi apiInstance = new WeatherForecastApi();
        String lat = lat_example; // String | latitude coordinates
        String lng = lng_example; // String | longitude coordinates
        try {
            weatherResponse result = apiInstance.getWeather(lat, lng);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling WeatherForecastApi#getWeather");
            e.printStackTrace();
        }
    }
}

                                                  

Configuration *apiConfig = [Configuration sharedConfig];

// Configure API key authorization: (authentication scheme: api_key)
[apiConfig setApiKey:@"YOUR_API_KEY" forApiKeyIdentifier:@"X-Mashape-Key"];
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//[apiConfig setApiKeyPrefix:@"Bearer" forApiKeyIdentifier:@"X-Mashape-Key"];


String *lat = lat_example; // latitude coordinates
String *lng = lng_example; // longitude coordinates

WeatherForecastApi *apiInstance = [[WeatherForecastApi alloc] init];

// Gets the weather forecast in abbreviated form
[apiInstance getWeatherWith:lat
    lng:lng
              completionHandler: ^(weatherResponse output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];

                                                    

var  = require('');
var defaultClient = .ApiClient.instance;

// Configure API key authorization: api_key
var api_key = defaultClient.authentications['api_key'];
api_key.apiKey = "YOUR API KEY"
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//api_key.apiKeyPrefix['X-Mashape-Key'] = "Token"

var api = new .WeatherForecastApi()

var lat = lat_example; // {String} latitude coordinates

var lng = lng_example; // {String} longitude coordinates


var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
api.getWeather(lat, lng, callback);

                                                    

using System;
using System.Diagnostics;
using .Api;
using .Client;
using ;

namespace Example
{
    public class getWeatherExample
    {
        public void main()
        {

            // Configure API key authorization: api_key
            Configuration.Default.ApiKey.Add("X-Mashape-Key", "YOUR_API_KEY");
            // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
            // Configuration.Default.ApiKeyPrefix.Add("X-Mashape-Key", "Bearer");

            var apiInstance = new WeatherForecastApi();
            var lat = lat_example;  // String | latitude coordinates
            var lng = lng_example;  // String | longitude coordinates

            try
            {
                // Gets the weather forecast in abbreviated form
                weatherResponse result = apiInstance.getWeather(lat, lng);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling WeatherForecastApi.getWeather: " + e.Message );
            }
        }
    }
}

                                                    

setApiKey('X-Mashape-Key', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// io.swagger.client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Mashape-Key', 'Bearer');

$api_instance = new io.swagger.client\Api\WeatherForecastApi();
$lat = lat_example; // String | latitude coordinates
$lng = lng_example; // String | longitude coordinates

try {
    $result = $api_instance->getWeather($lat, $lng);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling WeatherForecastApi->getWeather: ', $e->getMessage(), PHP_EOL;
}

                                                  

Parameters

Query parameters
Name Description
lat*
lng*

Responses

Status: 200 - weather response

26 c, Mostly Clear at Singapore, Singapore

Generated 2017-06-28T19:06:38.983Z