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
Name | Description |
---|---|
apieco-key* |
String
Required
|
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.
|