WeatherStack Documentation API

CurrentWeather

currentWeather

Current Weather

To query the weatherstack API for real-time weather data in a location of your choice, simply attach your preferred location to the API's current endpoint as seen in the example request below. Depending on your subscription, you can also make a bulk location request by passing multiple semicolon-separated locations to the API URL.


/current

Usage and SDK Samples

curl -X GET "https://api.apieco.ir/weather-stack/current?access_key=&units=&language=&callback="
import io.swagger.client.*;
import io.swagger.client.auth.*;
import io.swagger.client.model.*;
import io.swagger.client.api.CurrentWeatherApi;

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

public class CurrentWeatherApiExample {

    public static void main(String[] args) {
        
        CurrentWeatherApi apiInstance = new CurrentWeatherApi();
        String apiecoKey = apiecoKey_example; // String | 
        String accessKey = accessKey_example; // String | Provided API Key (Don`t Change The Value)
        String units = units_example; // String | Use this parameter to pass one of the unit identifiers ot the API: m for Metric s for Scientific f for Fahrenheit
        String language = language_example; // String | [Optional] Use this parameter to specify your preferred API response language using its ISO-code. (Default: unset, English)
        String callback = callback_example; // String |  Use this parameter to specify a JSONP callback function name to wrap your API response in.
        try {
            inline_response_200 result = apiInstance.currentWeather(apiecoKey, accessKey, units, language, callback);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling CurrentWeatherApi#currentWeather");
            e.printStackTrace();
        }
    }
}
import io.swagger.client.api.CurrentWeatherApi;

public class CurrentWeatherApiExample {

    public static void main(String[] args) {
        CurrentWeatherApi apiInstance = new CurrentWeatherApi();
        String apiecoKey = apiecoKey_example; // String | 
        String accessKey = accessKey_example; // String | Provided API Key (Don`t Change The Value)
        String units = units_example; // String | Use this parameter to pass one of the unit identifiers ot the API: m for Metric s for Scientific f for Fahrenheit
        String language = language_example; // String | [Optional] Use this parameter to specify your preferred API response language using its ISO-code. (Default: unset, English)
        String callback = callback_example; // String |  Use this parameter to specify a JSONP callback function name to wrap your API response in.
        try {
            inline_response_200 result = apiInstance.currentWeather(apiecoKey, accessKey, units, language, callback);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling CurrentWeatherApi#currentWeather");
            e.printStackTrace();
        }
    }
}
String *apiecoKey = apiecoKey_example; // 
String *accessKey = accessKey_example; // Provided API Key (Don`t Change The Value) (default to 4e0c2088825f6cd64383b3cbe7977f9d)
String *units = units_example; // Use this parameter to pass one of the unit identifiers ot the API: m for Metric s for Scientific f for Fahrenheit (optional)
String *language = language_example; // [Optional] Use this parameter to specify your preferred API response language using its ISO-code. (Default: unset, English) (optional) (default to en-us)
String *callback = callback_example; //  Use this parameter to specify a JSONP callback function name to wrap your API response in. (optional)

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

// Current Weather
[apiInstance currentWeatherWith:apiecoKey
    accessKey:accessKey
    units:units
    language:language
    callback:callback
              completionHandler: ^(inline_response_200 output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
var WeatherStackDocumentationApi = require('weather_stack_documentation_api');

var api = new WeatherStackDocumentationApi.CurrentWeatherApi()

var apiecoKey = apiecoKey_example; // {String} 

var accessKey = accessKey_example; // {String} Provided API Key (Don`t Change The Value)

var opts = { 
  'units': units_example, // {String} Use this parameter to pass one of the unit identifiers ot the API: m for Metric s for Scientific f for Fahrenheit
  'language': language_example, // {String} [Optional] Use this parameter to specify your preferred API response language using its ISO-code. (Default: unset, English)
  'callback': callback_example // {String}  Use this parameter to specify a JSONP callback function name to wrap your API response in.
};

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
api.currentWeather(apiecoKey, accessKey, opts, callback);
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;

namespace Example
{
    public class currentWeatherExample
    {
        public void main()
        {
            
            var apiInstance = new CurrentWeatherApi();
            var apiecoKey = apiecoKey_example;  // String | 
            var accessKey = accessKey_example;  // String | Provided API Key (Don`t Change The Value) (default to 4e0c2088825f6cd64383b3cbe7977f9d)
            var units = units_example;  // String | Use this parameter to pass one of the unit identifiers ot the API: m for Metric s for Scientific f for Fahrenheit (optional) 
            var language = language_example;  // String | [Optional] Use this parameter to specify your preferred API response language using its ISO-code. (Default: unset, English) (optional)  (default to en-us)
            var callback = callback_example;  // String |  Use this parameter to specify a JSONP callback function name to wrap your API response in. (optional) 

            try
            {
                // Current Weather
                inline_response_200 result = apiInstance.currentWeather(apiecoKey, accessKey, units, language, callback);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling CurrentWeatherApi.currentWeather: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

$api_instance = new Swagger\Client\Api\CurrentWeatherApi();
$apiecoKey = apiecoKey_example; // String | 
$accessKey = accessKey_example; // String | Provided API Key (Don`t Change The Value)
$units = units_example; // String | Use this parameter to pass one of the unit identifiers ot the API: m for Metric s for Scientific f for Fahrenheit
$language = language_example; // String | [Optional] Use this parameter to specify your preferred API response language using its ISO-code. (Default: unset, English)
$callback = callback_example; // String |  Use this parameter to specify a JSONP callback function name to wrap your API response in.

try {
    $result = $api_instance->currentWeather($apiecoKey, $accessKey, $units, $language, $callback);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling CurrentWeatherApi->currentWeather: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use WWW::SwaggerClient::Configuration;
use WWW::SwaggerClient::CurrentWeatherApi;

my $api_instance = WWW::SwaggerClient::CurrentWeatherApi->new();
my $apiecoKey = apiecoKey_example; # String | 
my $accessKey = accessKey_example; # String | Provided API Key (Don`t Change The Value)
my $units = units_example; # String | Use this parameter to pass one of the unit identifiers ot the API: m for Metric s for Scientific f for Fahrenheit
my $language = language_example; # String | [Optional] Use this parameter to specify your preferred API response language using its ISO-code. (Default: unset, English)
my $callback = callback_example; # String |  Use this parameter to specify a JSONP callback function name to wrap your API response in.

eval { 
    my $result = $api_instance->currentWeather(apiecoKey => $apiecoKey, accessKey => $accessKey, units => $units, language => $language, callback => $callback);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling CurrentWeatherApi->currentWeather: $@\n";
}
from __future__ import print_statement
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint

# create an instance of the API class
api_instance = swagger_client.CurrentWeatherApi()
apiecoKey = apiecoKey_example # String | 
accessKey = accessKey_example # String | Provided API Key (Don`t Change The Value) (default to 4e0c2088825f6cd64383b3cbe7977f9d)
units = units_example # String | Use this parameter to pass one of the unit identifiers ot the API: m for Metric s for Scientific f for Fahrenheit (optional)
language = language_example # String | [Optional] Use this parameter to specify your preferred API response language using its ISO-code. (Default: unset, English) (optional) (default to en-us)
callback = callback_example # String |  Use this parameter to specify a JSONP callback function name to wrap your API response in. (optional)

try: 
    # Current Weather
    api_response = api_instance.current_weather(apiecoKey, accessKey, units=units, language=language, callback=callback)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling CurrentWeatherApi->currentWeather: %s\n" % e)

Parameters

Header parameters
Name Description
apieco-key*
String
Required
Query parameters
Name Description
access_key*
String
Provided API Key (Don`t Change The Value)
Required
units
String
Use this parameter to pass one of the unit identifiers ot the API: m for Metric s for Scientific f for Fahrenheit
language
String
[Optional] Use this parameter to specify your preferred API response language using its ISO-code. (Default: unset, English)
callback
String
Use this parameter to specify a JSONP callback function name to wrap your API response in.

Responses

Status: 200 - Successful


HistoricalWeather

historicalWeather

Historical Weather

To look up historical weather data all the way back to 2008, simply pass one date of your choice (later than July 2008) or multiple semicolon-separated dates to the weatherstack API's historical endpoint using the historical_date parameter.


/historical

Usage and SDK Samples

curl -X GET "https://api.apieco.ir/weather-stack/historical?access_key=&query=&historical_date=&hourly=&interval=&units=&language=&callback="
import io.swagger.client.*;
import io.swagger.client.auth.*;
import io.swagger.client.model.*;
import io.swagger.client.api.HistoricalWeatherApi;

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

public class HistoricalWeatherApiExample {

    public static void main(String[] args) {
        
        HistoricalWeatherApi apiInstance = new HistoricalWeatherApi();
        String apiecoKey = apiecoKey_example; // String | 
        String accessKey = accessKey_example; // String | Provided API Key (Don`t Change The Value)
        String query = query_example; // String | Use this parameter to pass a single location or multiple semicolon-separated location identifiers to the API
        String historicalDate = historicalDate_example; // String | Use this parameter to pass one historical date or multiple semicolon-separated dates to the API. (Example: 2015-01-21 for a single date or 2015-01-21;2015-01-22 for multiple dates)
        Integer hourly = 56; // Integer | Set this parameter to 1 (on) or 0 (off) depending on whether or not you want the API to return weather data split hourly. (Default: 0 - off)
        Integer interval = 56; // Integer |  If hourly data is enabled, use this parameter to define the interval: 1 hour 3 hourly (default) 6 hourly 12 hourly (day/night) 24 hourly (day average)                       
        String units = units_example; // String | Use this parameter to pass one of the unit identifiers ot the API: m for Metric s for Scientific f for Fahrenheit
        String language = language_example; // String | [Optional] Use this parameter to specify your preferred API response language using its ISO-code. (Default: unset, English)
        String callback = callback_example; // String |  Use this parameter to specify a JSONP callback function name to wrap your API response in.
        try {
            inline_response_200_1 result = apiInstance.historicalWeather(apiecoKey, accessKey, query, historicalDate, hourly, interval, units, language, callback);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling HistoricalWeatherApi#historicalWeather");
            e.printStackTrace();
        }
    }
}
import io.swagger.client.api.HistoricalWeatherApi;

public class HistoricalWeatherApiExample {

    public static void main(String[] args) {
        HistoricalWeatherApi apiInstance = new HistoricalWeatherApi();
        String apiecoKey = apiecoKey_example; // String | 
        String accessKey = accessKey_example; // String | Provided API Key (Don`t Change The Value)
        String query = query_example; // String | Use this parameter to pass a single location or multiple semicolon-separated location identifiers to the API
        String historicalDate = historicalDate_example; // String | Use this parameter to pass one historical date or multiple semicolon-separated dates to the API. (Example: 2015-01-21 for a single date or 2015-01-21;2015-01-22 for multiple dates)
        Integer hourly = 56; // Integer | Set this parameter to 1 (on) or 0 (off) depending on whether or not you want the API to return weather data split hourly. (Default: 0 - off)
        Integer interval = 56; // Integer |  If hourly data is enabled, use this parameter to define the interval: 1 hour 3 hourly (default) 6 hourly 12 hourly (day/night) 24 hourly (day average)                       
        String units = units_example; // String | Use this parameter to pass one of the unit identifiers ot the API: m for Metric s for Scientific f for Fahrenheit
        String language = language_example; // String | [Optional] Use this parameter to specify your preferred API response language using its ISO-code. (Default: unset, English)
        String callback = callback_example; // String |  Use this parameter to specify a JSONP callback function name to wrap your API response in.
        try {
            inline_response_200_1 result = apiInstance.historicalWeather(apiecoKey, accessKey, query, historicalDate, hourly, interval, units, language, callback);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling HistoricalWeatherApi#historicalWeather");
            e.printStackTrace();
        }
    }
}
String *apiecoKey = apiecoKey_example; // 
String *accessKey = accessKey_example; // Provided API Key (Don`t Change The Value) (default to 4e0c2088825f6cd64383b3cbe7977f9d)
String *query = query_example; // Use this parameter to pass a single location or multiple semicolon-separated location identifiers to the API
String *historicalDate = historicalDate_example; // Use this parameter to pass one historical date or multiple semicolon-separated dates to the API. (Example: 2015-01-21 for a single date or 2015-01-21;2015-01-22 for multiple dates)
Integer *hourly = 56; // Set this parameter to 1 (on) or 0 (off) depending on whether or not you want the API to return weather data split hourly. (Default: 0 - off) (optional)
Integer *interval = 56; //  If hourly data is enabled, use this parameter to define the interval: 1 hour 3 hourly (default) 6 hourly 12 hourly (day/night) 24 hourly (day average)                        (optional)
String *units = units_example; // Use this parameter to pass one of the unit identifiers ot the API: m for Metric s for Scientific f for Fahrenheit (optional)
String *language = language_example; // [Optional] Use this parameter to specify your preferred API response language using its ISO-code. (Default: unset, English) (optional) (default to en-us)
String *callback = callback_example; //  Use this parameter to specify a JSONP callback function name to wrap your API response in. (optional)

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

// Historical Weather
[apiInstance historicalWeatherWith:apiecoKey
    accessKey:accessKey
    query:query
    historicalDate:historicalDate
    hourly:hourly
    interval:interval
    units:units
    language:language
    callback:callback
              completionHandler: ^(inline_response_200_1 output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
var WeatherStackDocumentationApi = require('weather_stack_documentation_api');

var api = new WeatherStackDocumentationApi.HistoricalWeatherApi()

var apiecoKey = apiecoKey_example; // {String} 

var accessKey = accessKey_example; // {String} Provided API Key (Don`t Change The Value)

var query = query_example; // {String} Use this parameter to pass a single location or multiple semicolon-separated location identifiers to the API

var historicalDate = historicalDate_example; // {String} Use this parameter to pass one historical date or multiple semicolon-separated dates to the API. (Example: 2015-01-21 for a single date or 2015-01-21;2015-01-22 for multiple dates)

var opts = { 
  'hourly': 56, // {Integer} Set this parameter to 1 (on) or 0 (off) depending on whether or not you want the API to return weather data split hourly. (Default: 0 - off)
  'interval': 56, // {Integer}  If hourly data is enabled, use this parameter to define the interval: 1 hour 3 hourly (default) 6 hourly 12 hourly (day/night) 24 hourly (day average)                       
  'units': units_example, // {String} Use this parameter to pass one of the unit identifiers ot the API: m for Metric s for Scientific f for Fahrenheit
  'language': language_example, // {String} [Optional] Use this parameter to specify your preferred API response language using its ISO-code. (Default: unset, English)
  'callback': callback_example // {String}  Use this parameter to specify a JSONP callback function name to wrap your API response in.
};

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
api.historicalWeather(apiecoKey, accessKey, query, historicalDate, opts, callback);
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;

namespace Example
{
    public class historicalWeatherExample
    {
        public void main()
        {
            
            var apiInstance = new HistoricalWeatherApi();
            var apiecoKey = apiecoKey_example;  // String | 
            var accessKey = accessKey_example;  // String | Provided API Key (Don`t Change The Value) (default to 4e0c2088825f6cd64383b3cbe7977f9d)
            var query = query_example;  // String | Use this parameter to pass a single location or multiple semicolon-separated location identifiers to the API
            var historicalDate = historicalDate_example;  // String | Use this parameter to pass one historical date or multiple semicolon-separated dates to the API. (Example: 2015-01-21 for a single date or 2015-01-21;2015-01-22 for multiple dates)
            var hourly = 56;  // Integer | Set this parameter to 1 (on) or 0 (off) depending on whether or not you want the API to return weather data split hourly. (Default: 0 - off) (optional) 
            var interval = 56;  // Integer |  If hourly data is enabled, use this parameter to define the interval: 1 hour 3 hourly (default) 6 hourly 12 hourly (day/night) 24 hourly (day average)                        (optional) 
            var units = units_example;  // String | Use this parameter to pass one of the unit identifiers ot the API: m for Metric s for Scientific f for Fahrenheit (optional) 
            var language = language_example;  // String | [Optional] Use this parameter to specify your preferred API response language using its ISO-code. (Default: unset, English) (optional)  (default to en-us)
            var callback = callback_example;  // String |  Use this parameter to specify a JSONP callback function name to wrap your API response in. (optional) 

            try
            {
                // Historical Weather
                inline_response_200_1 result = apiInstance.historicalWeather(apiecoKey, accessKey, query, historicalDate, hourly, interval, units, language, callback);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling HistoricalWeatherApi.historicalWeather: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

$api_instance = new Swagger\Client\Api\HistoricalWeatherApi();
$apiecoKey = apiecoKey_example; // String | 
$accessKey = accessKey_example; // String | Provided API Key (Don`t Change The Value)
$query = query_example; // String | Use this parameter to pass a single location or multiple semicolon-separated location identifiers to the API
$historicalDate = historicalDate_example; // String | Use this parameter to pass one historical date or multiple semicolon-separated dates to the API. (Example: 2015-01-21 for a single date or 2015-01-21;2015-01-22 for multiple dates)
$hourly = 56; // Integer | Set this parameter to 1 (on) or 0 (off) depending on whether or not you want the API to return weather data split hourly. (Default: 0 - off)
$interval = 56; // Integer |  If hourly data is enabled, use this parameter to define the interval: 1 hour 3 hourly (default) 6 hourly 12 hourly (day/night) 24 hourly (day average)                       
$units = units_example; // String | Use this parameter to pass one of the unit identifiers ot the API: m for Metric s for Scientific f for Fahrenheit
$language = language_example; // String | [Optional] Use this parameter to specify your preferred API response language using its ISO-code. (Default: unset, English)
$callback = callback_example; // String |  Use this parameter to specify a JSONP callback function name to wrap your API response in.

try {
    $result = $api_instance->historicalWeather($apiecoKey, $accessKey, $query, $historicalDate, $hourly, $interval, $units, $language, $callback);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling HistoricalWeatherApi->historicalWeather: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use WWW::SwaggerClient::Configuration;
use WWW::SwaggerClient::HistoricalWeatherApi;

my $api_instance = WWW::SwaggerClient::HistoricalWeatherApi->new();
my $apiecoKey = apiecoKey_example; # String | 
my $accessKey = accessKey_example; # String | Provided API Key (Don`t Change The Value)
my $query = query_example; # String | Use this parameter to pass a single location or multiple semicolon-separated location identifiers to the API
my $historicalDate = historicalDate_example; # String | Use this parameter to pass one historical date or multiple semicolon-separated dates to the API. (Example: 2015-01-21 for a single date or 2015-01-21;2015-01-22 for multiple dates)
my $hourly = 56; # Integer | Set this parameter to 1 (on) or 0 (off) depending on whether or not you want the API to return weather data split hourly. (Default: 0 - off)
my $interval = 56; # Integer |  If hourly data is enabled, use this parameter to define the interval: 1 hour 3 hourly (default) 6 hourly 12 hourly (day/night) 24 hourly (day average)                       
my $units = units_example; # String | Use this parameter to pass one of the unit identifiers ot the API: m for Metric s for Scientific f for Fahrenheit
my $language = language_example; # String | [Optional] Use this parameter to specify your preferred API response language using its ISO-code. (Default: unset, English)
my $callback = callback_example; # String |  Use this parameter to specify a JSONP callback function name to wrap your API response in.

eval { 
    my $result = $api_instance->historicalWeather(apiecoKey => $apiecoKey, accessKey => $accessKey, query => $query, historicalDate => $historicalDate, hourly => $hourly, interval => $interval, units => $units, language => $language, callback => $callback);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling HistoricalWeatherApi->historicalWeather: $@\n";
}
from __future__ import print_statement
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint

# create an instance of the API class
api_instance = swagger_client.HistoricalWeatherApi()
apiecoKey = apiecoKey_example # String | 
accessKey = accessKey_example # String | Provided API Key (Don`t Change The Value) (default to 4e0c2088825f6cd64383b3cbe7977f9d)
query = query_example # String | Use this parameter to pass a single location or multiple semicolon-separated location identifiers to the API
historicalDate = historicalDate_example # String | Use this parameter to pass one historical date or multiple semicolon-separated dates to the API. (Example: 2015-01-21 for a single date or 2015-01-21;2015-01-22 for multiple dates)
hourly = 56 # Integer | Set this parameter to 1 (on) or 0 (off) depending on whether or not you want the API to return weather data split hourly. (Default: 0 - off) (optional)
interval = 56 # Integer |  If hourly data is enabled, use this parameter to define the interval: 1 hour 3 hourly (default) 6 hourly 12 hourly (day/night) 24 hourly (day average)                        (optional)
units = units_example # String | Use this parameter to pass one of the unit identifiers ot the API: m for Metric s for Scientific f for Fahrenheit (optional)
language = language_example # String | [Optional] Use this parameter to specify your preferred API response language using its ISO-code. (Default: unset, English) (optional) (default to en-us)
callback = callback_example # String |  Use this parameter to specify a JSONP callback function name to wrap your API response in. (optional)

try: 
    # Historical Weather
    api_response = api_instance.historical_weather(apiecoKey, accessKey, query, historicalDate, hourly=hourly, interval=interval, units=units, language=language, callback=callback)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling HistoricalWeatherApi->historicalWeather: %s\n" % e)

Parameters

Header parameters
Name Description
apieco-key*
String
Required
Query parameters
Name Description
access_key*
String
Provided API Key (Don`t Change The Value)
Required
query*
String
Use this parameter to pass a single location or multiple semicolon-separated location identifiers to the API
Required
historical_date*
String
Use this parameter to pass one historical date or multiple semicolon-separated dates to the API. (Example: 2015-01-21 for a single date or 2015-01-21;2015-01-22 for multiple dates)
Required
hourly
Integer
Set this parameter to 1 (on) or 0 (off) depending on whether or not you want the API to return weather data split hourly. (Default: 0 - off)
interval
Integer
If hourly data is enabled, use this parameter to define the interval: 1 hour 3 hourly (default) 6 hourly 12 hourly (day/night) 24 hourly (day average)
units
String
Use this parameter to pass one of the unit identifiers ot the API: m for Metric s for Scientific f for Fahrenheit
language
String
[Optional] Use this parameter to specify your preferred API response language using its ISO-code. (Default: unset, English)
callback
String
Use this parameter to specify a JSONP callback function name to wrap your API response in.

Responses

Status: 200 - Successful


LocationLookupAutocomplete

autocomplete

Location Lookup/Autocomplete

The weatherstack API's location autocomplete endpoint can be used to pinpoint one or more specific locations and their identifying response objects with the aim of later passing them to a weather data endpoint. In our example below, we are looking for London, United Kingdom.


/autocomplete

Usage and SDK Samples

curl -X GET "https://api.apieco.ir/weather-stack/autocomplete?access_key=&query=&callback="
import io.swagger.client.*;
import io.swagger.client.auth.*;
import io.swagger.client.model.*;
import io.swagger.client.api.LocationLookupAutocompleteApi;

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

public class LocationLookupAutocompleteApiExample {

    public static void main(String[] args) {
        
        LocationLookupAutocompleteApi apiInstance = new LocationLookupAutocompleteApi();
        String apiecoKey = apiecoKey_example; // String | 
        String accessKey = accessKey_example; // String | Provided API Key (Don`t Change The Value)
        String query = query_example; // String | Use this parameter to pass a single location or multiple semicolon-separated location identifiers to the API
        String callback = callback_example; // String |  Use this parameter to specify a JSONP callback function name to wrap your API response in.
        try {
            inline_response_200_3 result = apiInstance.autocomplete(apiecoKey, accessKey, query, callback);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling LocationLookupAutocompleteApi#autocomplete");
            e.printStackTrace();
        }
    }
}
import io.swagger.client.api.LocationLookupAutocompleteApi;

public class LocationLookupAutocompleteApiExample {

    public static void main(String[] args) {
        LocationLookupAutocompleteApi apiInstance = new LocationLookupAutocompleteApi();
        String apiecoKey = apiecoKey_example; // String | 
        String accessKey = accessKey_example; // String | Provided API Key (Don`t Change The Value)
        String query = query_example; // String | Use this parameter to pass a single location or multiple semicolon-separated location identifiers to the API
        String callback = callback_example; // String |  Use this parameter to specify a JSONP callback function name to wrap your API response in.
        try {
            inline_response_200_3 result = apiInstance.autocomplete(apiecoKey, accessKey, query, callback);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling LocationLookupAutocompleteApi#autocomplete");
            e.printStackTrace();
        }
    }
}
String *apiecoKey = apiecoKey_example; // 
String *accessKey = accessKey_example; // Provided API Key (Don`t Change The Value) (default to 4e0c2088825f6cd64383b3cbe7977f9d)
String *query = query_example; // Use this parameter to pass a single location or multiple semicolon-separated location identifiers to the API
String *callback = callback_example; //  Use this parameter to specify a JSONP callback function name to wrap your API response in. (optional)

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

// Location Lookup/Autocomplete
[apiInstance autocompleteWith:apiecoKey
    accessKey:accessKey
    query:query
    callback:callback
              completionHandler: ^(inline_response_200_3 output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
var WeatherStackDocumentationApi = require('weather_stack_documentation_api');

var api = new WeatherStackDocumentationApi.LocationLookupAutocompleteApi()

var apiecoKey = apiecoKey_example; // {String} 

var accessKey = accessKey_example; // {String} Provided API Key (Don`t Change The Value)

var query = query_example; // {String} Use this parameter to pass a single location or multiple semicolon-separated location identifiers to the API

var opts = { 
  'callback': callback_example // {String}  Use this parameter to specify a JSONP callback function name to wrap your API response in.
};

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
api.autocomplete(apiecoKey, accessKey, query, opts, callback);
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;

namespace Example
{
    public class autocompleteExample
    {
        public void main()
        {
            
            var apiInstance = new LocationLookupAutocompleteApi();
            var apiecoKey = apiecoKey_example;  // String | 
            var accessKey = accessKey_example;  // String | Provided API Key (Don`t Change The Value) (default to 4e0c2088825f6cd64383b3cbe7977f9d)
            var query = query_example;  // String | Use this parameter to pass a single location or multiple semicolon-separated location identifiers to the API
            var callback = callback_example;  // String |  Use this parameter to specify a JSONP callback function name to wrap your API response in. (optional) 

            try
            {
                // Location Lookup/Autocomplete
                inline_response_200_3 result = apiInstance.autocomplete(apiecoKey, accessKey, query, callback);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling LocationLookupAutocompleteApi.autocomplete: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

$api_instance = new Swagger\Client\Api\LocationLookupAutocompleteApi();
$apiecoKey = apiecoKey_example; // String | 
$accessKey = accessKey_example; // String | Provided API Key (Don`t Change The Value)
$query = query_example; // String | Use this parameter to pass a single location or multiple semicolon-separated location identifiers to the API
$callback = callback_example; // String |  Use this parameter to specify a JSONP callback function name to wrap your API response in.

try {
    $result = $api_instance->autocomplete($apiecoKey, $accessKey, $query, $callback);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling LocationLookupAutocompleteApi->autocomplete: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use WWW::SwaggerClient::Configuration;
use WWW::SwaggerClient::LocationLookupAutocompleteApi;

my $api_instance = WWW::SwaggerClient::LocationLookupAutocompleteApi->new();
my $apiecoKey = apiecoKey_example; # String | 
my $accessKey = accessKey_example; # String | Provided API Key (Don`t Change The Value)
my $query = query_example; # String | Use this parameter to pass a single location or multiple semicolon-separated location identifiers to the API
my $callback = callback_example; # String |  Use this parameter to specify a JSONP callback function name to wrap your API response in.

eval { 
    my $result = $api_instance->autocomplete(apiecoKey => $apiecoKey, accessKey => $accessKey, query => $query, callback => $callback);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling LocationLookupAutocompleteApi->autocomplete: $@\n";
}
from __future__ import print_statement
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint

# create an instance of the API class
api_instance = swagger_client.LocationLookupAutocompleteApi()
apiecoKey = apiecoKey_example # String | 
accessKey = accessKey_example # String | Provided API Key (Don`t Change The Value) (default to 4e0c2088825f6cd64383b3cbe7977f9d)
query = query_example # String | Use this parameter to pass a single location or multiple semicolon-separated location identifiers to the API
callback = callback_example # String |  Use this parameter to specify a JSONP callback function name to wrap your API response in. (optional)

try: 
    # Location Lookup/Autocomplete
    api_response = api_instance.autocomplete(apiecoKey, accessKey, query, callback=callback)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling LocationLookupAutocompleteApi->autocomplete: %s\n" % e)

Parameters

Header parameters
Name Description
apieco-key*
String
Required
Query parameters
Name Description
access_key*
String
Provided API Key (Don`t Change The Value)
Required
query*
String
Use this parameter to pass a single location or multiple semicolon-separated location identifiers to the API
Required
callback
String
Use this parameter to specify a JSONP callback function name to wrap your API response in.

Responses

Status: 200 - Successful


WeatherForecast

weatherForecast

Weather Forecast

The weatherstack is capable of returning weather forecast data for up to 14 days into the future. To get weather forecasts, simply use the API's forecast and define your preferred number of forecast days using the forecast_days parameter.


/forecast

Usage and SDK Samples

curl -X GET "https://api.apieco.ir/weather-stack/forecast?access_key=&query=&forecast_days=&hourly=&interval=&units=&language=&callback="
import io.swagger.client.*;
import io.swagger.client.auth.*;
import io.swagger.client.model.*;
import io.swagger.client.api.WeatherForecastApi;

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

public class WeatherForecastApiExample {

    public static void main(String[] args) {
        
        WeatherForecastApi apiInstance = new WeatherForecastApi();
        String apiecoKey = apiecoKey_example; // String | 
        String accessKey = accessKey_example; // String | Provided API Key (Don`t Change The Value)
        String query = query_example; // String | Use this parameter to pass a single location or multiple semicolon-separated location identifiers to the API
        String forecastDays = forecastDays_example; // String | Use this parameter to specify the number of days for which the API returns forecast data. (Default: 7 or 14 days, depending on your subscription)
        Integer hourly = 56; // Integer | Set this parameter to 1 (on) or 0 (off) depending on whether or not you want the API to return weather data split hourly. (Default: 0 - off)
        Integer interval = 56; // Integer |  If hourly data is enabled, use this parameter to define the interval: 1 hour 3 hourly (default) 6 hourly 12 hourly (day/night) 24 hourly (day average)                       
        String units = units_example; // String | Use this parameter to pass one of the unit identifiers ot the API: m for Metric s for Scientific f for Fahrenheit
        String language = language_example; // String | [Optional] Use this parameter to specify your preferred API response language using its ISO-code. (Default: unset, English)
        String callback = callback_example; // String |  Use this parameter to specify a JSONP callback function name to wrap your API response in.
        try {
            inline_response_200_2 result = apiInstance.weatherForecast(apiecoKey, accessKey, query, forecastDays, hourly, interval, units, language, callback);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling WeatherForecastApi#weatherForecast");
            e.printStackTrace();
        }
    }
}
import io.swagger.client.api.WeatherForecastApi;

public class WeatherForecastApiExample {

    public static void main(String[] args) {
        WeatherForecastApi apiInstance = new WeatherForecastApi();
        String apiecoKey = apiecoKey_example; // String | 
        String accessKey = accessKey_example; // String | Provided API Key (Don`t Change The Value)
        String query = query_example; // String | Use this parameter to pass a single location or multiple semicolon-separated location identifiers to the API
        String forecastDays = forecastDays_example; // String | Use this parameter to specify the number of days for which the API returns forecast data. (Default: 7 or 14 days, depending on your subscription)
        Integer hourly = 56; // Integer | Set this parameter to 1 (on) or 0 (off) depending on whether or not you want the API to return weather data split hourly. (Default: 0 - off)
        Integer interval = 56; // Integer |  If hourly data is enabled, use this parameter to define the interval: 1 hour 3 hourly (default) 6 hourly 12 hourly (day/night) 24 hourly (day average)                       
        String units = units_example; // String | Use this parameter to pass one of the unit identifiers ot the API: m for Metric s for Scientific f for Fahrenheit
        String language = language_example; // String | [Optional] Use this parameter to specify your preferred API response language using its ISO-code. (Default: unset, English)
        String callback = callback_example; // String |  Use this parameter to specify a JSONP callback function name to wrap your API response in.
        try {
            inline_response_200_2 result = apiInstance.weatherForecast(apiecoKey, accessKey, query, forecastDays, hourly, interval, units, language, callback);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling WeatherForecastApi#weatherForecast");
            e.printStackTrace();
        }
    }
}
String *apiecoKey = apiecoKey_example; // 
String *accessKey = accessKey_example; // Provided API Key (Don`t Change The Value) (default to 4e0c2088825f6cd64383b3cbe7977f9d)
String *query = query_example; // Use this parameter to pass a single location or multiple semicolon-separated location identifiers to the API
String *forecastDays = forecastDays_example; // Use this parameter to specify the number of days for which the API returns forecast data. (Default: 7 or 14 days, depending on your subscription) (optional)
Integer *hourly = 56; // Set this parameter to 1 (on) or 0 (off) depending on whether or not you want the API to return weather data split hourly. (Default: 0 - off) (optional)
Integer *interval = 56; //  If hourly data is enabled, use this parameter to define the interval: 1 hour 3 hourly (default) 6 hourly 12 hourly (day/night) 24 hourly (day average)                        (optional)
String *units = units_example; // Use this parameter to pass one of the unit identifiers ot the API: m for Metric s for Scientific f for Fahrenheit (optional)
String *language = language_example; // [Optional] Use this parameter to specify your preferred API response language using its ISO-code. (Default: unset, English) (optional) (default to en-us)
String *callback = callback_example; //  Use this parameter to specify a JSONP callback function name to wrap your API response in. (optional)

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

// Weather Forecast
[apiInstance weatherForecastWith:apiecoKey
    accessKey:accessKey
    query:query
    forecastDays:forecastDays
    hourly:hourly
    interval:interval
    units:units
    language:language
    callback:callback
              completionHandler: ^(inline_response_200_2 output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
var WeatherStackDocumentationApi = require('weather_stack_documentation_api');

var api = new WeatherStackDocumentationApi.WeatherForecastApi()

var apiecoKey = apiecoKey_example; // {String} 

var accessKey = accessKey_example; // {String} Provided API Key (Don`t Change The Value)

var query = query_example; // {String} Use this parameter to pass a single location or multiple semicolon-separated location identifiers to the API

var opts = { 
  'forecastDays': forecastDays_example, // {String} Use this parameter to specify the number of days for which the API returns forecast data. (Default: 7 or 14 days, depending on your subscription)
  'hourly': 56, // {Integer} Set this parameter to 1 (on) or 0 (off) depending on whether or not you want the API to return weather data split hourly. (Default: 0 - off)
  'interval': 56, // {Integer}  If hourly data is enabled, use this parameter to define the interval: 1 hour 3 hourly (default) 6 hourly 12 hourly (day/night) 24 hourly (day average)                       
  'units': units_example, // {String} Use this parameter to pass one of the unit identifiers ot the API: m for Metric s for Scientific f for Fahrenheit
  'language': language_example, // {String} [Optional] Use this parameter to specify your preferred API response language using its ISO-code. (Default: unset, English)
  'callback': callback_example // {String}  Use this parameter to specify a JSONP callback function name to wrap your API response in.
};

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
api.weatherForecast(apiecoKey, accessKey, query, opts, callback);
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;

namespace Example
{
    public class weatherForecastExample
    {
        public void main()
        {
            
            var apiInstance = new WeatherForecastApi();
            var apiecoKey = apiecoKey_example;  // String | 
            var accessKey = accessKey_example;  // String | Provided API Key (Don`t Change The Value) (default to 4e0c2088825f6cd64383b3cbe7977f9d)
            var query = query_example;  // String | Use this parameter to pass a single location or multiple semicolon-separated location identifiers to the API
            var forecastDays = forecastDays_example;  // String | Use this parameter to specify the number of days for which the API returns forecast data. (Default: 7 or 14 days, depending on your subscription) (optional) 
            var hourly = 56;  // Integer | Set this parameter to 1 (on) or 0 (off) depending on whether or not you want the API to return weather data split hourly. (Default: 0 - off) (optional) 
            var interval = 56;  // Integer |  If hourly data is enabled, use this parameter to define the interval: 1 hour 3 hourly (default) 6 hourly 12 hourly (day/night) 24 hourly (day average)                        (optional) 
            var units = units_example;  // String | Use this parameter to pass one of the unit identifiers ot the API: m for Metric s for Scientific f for Fahrenheit (optional) 
            var language = language_example;  // String | [Optional] Use this parameter to specify your preferred API response language using its ISO-code. (Default: unset, English) (optional)  (default to en-us)
            var callback = callback_example;  // String |  Use this parameter to specify a JSONP callback function name to wrap your API response in. (optional) 

            try
            {
                // Weather Forecast
                inline_response_200_2 result = apiInstance.weatherForecast(apiecoKey, accessKey, query, forecastDays, hourly, interval, units, language, callback);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling WeatherForecastApi.weatherForecast: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

$api_instance = new Swagger\Client\Api\WeatherForecastApi();
$apiecoKey = apiecoKey_example; // String | 
$accessKey = accessKey_example; // String | Provided API Key (Don`t Change The Value)
$query = query_example; // String | Use this parameter to pass a single location or multiple semicolon-separated location identifiers to the API
$forecastDays = forecastDays_example; // String | Use this parameter to specify the number of days for which the API returns forecast data. (Default: 7 or 14 days, depending on your subscription)
$hourly = 56; // Integer | Set this parameter to 1 (on) or 0 (off) depending on whether or not you want the API to return weather data split hourly. (Default: 0 - off)
$interval = 56; // Integer |  If hourly data is enabled, use this parameter to define the interval: 1 hour 3 hourly (default) 6 hourly 12 hourly (day/night) 24 hourly (day average)                       
$units = units_example; // String | Use this parameter to pass one of the unit identifiers ot the API: m for Metric s for Scientific f for Fahrenheit
$language = language_example; // String | [Optional] Use this parameter to specify your preferred API response language using its ISO-code. (Default: unset, English)
$callback = callback_example; // String |  Use this parameter to specify a JSONP callback function name to wrap your API response in.

try {
    $result = $api_instance->weatherForecast($apiecoKey, $accessKey, $query, $forecastDays, $hourly, $interval, $units, $language, $callback);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling WeatherForecastApi->weatherForecast: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use WWW::SwaggerClient::Configuration;
use WWW::SwaggerClient::WeatherForecastApi;

my $api_instance = WWW::SwaggerClient::WeatherForecastApi->new();
my $apiecoKey = apiecoKey_example; # String | 
my $accessKey = accessKey_example; # String | Provided API Key (Don`t Change The Value)
my $query = query_example; # String | Use this parameter to pass a single location or multiple semicolon-separated location identifiers to the API
my $forecastDays = forecastDays_example; # String | Use this parameter to specify the number of days for which the API returns forecast data. (Default: 7 or 14 days, depending on your subscription)
my $hourly = 56; # Integer | Set this parameter to 1 (on) or 0 (off) depending on whether or not you want the API to return weather data split hourly. (Default: 0 - off)
my $interval = 56; # Integer |  If hourly data is enabled, use this parameter to define the interval: 1 hour 3 hourly (default) 6 hourly 12 hourly (day/night) 24 hourly (day average)                       
my $units = units_example; # String | Use this parameter to pass one of the unit identifiers ot the API: m for Metric s for Scientific f for Fahrenheit
my $language = language_example; # String | [Optional] Use this parameter to specify your preferred API response language using its ISO-code. (Default: unset, English)
my $callback = callback_example; # String |  Use this parameter to specify a JSONP callback function name to wrap your API response in.

eval { 
    my $result = $api_instance->weatherForecast(apiecoKey => $apiecoKey, accessKey => $accessKey, query => $query, forecastDays => $forecastDays, hourly => $hourly, interval => $interval, units => $units, language => $language, callback => $callback);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling WeatherForecastApi->weatherForecast: $@\n";
}
from __future__ import print_statement
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint

# create an instance of the API class
api_instance = swagger_client.WeatherForecastApi()
apiecoKey = apiecoKey_example # String | 
accessKey = accessKey_example # String | Provided API Key (Don`t Change The Value) (default to 4e0c2088825f6cd64383b3cbe7977f9d)
query = query_example # String | Use this parameter to pass a single location or multiple semicolon-separated location identifiers to the API
forecastDays = forecastDays_example # String | Use this parameter to specify the number of days for which the API returns forecast data. (Default: 7 or 14 days, depending on your subscription) (optional)
hourly = 56 # Integer | Set this parameter to 1 (on) or 0 (off) depending on whether or not you want the API to return weather data split hourly. (Default: 0 - off) (optional)
interval = 56 # Integer |  If hourly data is enabled, use this parameter to define the interval: 1 hour 3 hourly (default) 6 hourly 12 hourly (day/night) 24 hourly (day average)                        (optional)
units = units_example # String | Use this parameter to pass one of the unit identifiers ot the API: m for Metric s for Scientific f for Fahrenheit (optional)
language = language_example # String | [Optional] Use this parameter to specify your preferred API response language using its ISO-code. (Default: unset, English) (optional) (default to en-us)
callback = callback_example # String |  Use this parameter to specify a JSONP callback function name to wrap your API response in. (optional)

try: 
    # Weather Forecast
    api_response = api_instance.weather_forecast(apiecoKey, accessKey, query, forecastDays=forecastDays, hourly=hourly, interval=interval, units=units, language=language, callback=callback)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling WeatherForecastApi->weatherForecast: %s\n" % e)

Parameters

Header parameters
Name Description
apieco-key*
String
Required
Query parameters
Name Description
access_key*
String
Provided API Key (Don`t Change The Value)
Required
query*
String
Use this parameter to pass a single location or multiple semicolon-separated location identifiers to the API
Required
forecast_days
String
Use this parameter to specify the number of days for which the API returns forecast data. (Default: 7 or 14 days, depending on your subscription)
hourly
Integer
Set this parameter to 1 (on) or 0 (off) depending on whether or not you want the API to return weather data split hourly. (Default: 0 - off)
interval
Integer
If hourly data is enabled, use this parameter to define the interval: 1 hour 3 hourly (default) 6 hourly 12 hourly (day/night) 24 hourly (day average)
units
String
Use this parameter to pass one of the unit identifiers ot the API: m for Metric s for Scientific f for Fahrenheit
language
String
[Optional] Use this parameter to specify your preferred API response language using its ISO-code. (Default: unset, English)
callback
String
Use this parameter to specify a JSONP callback function name to wrap your API response in.

Responses

Status: 200 - Successful