APIs for Personal Weather Station Contributors. This is an unofficial openAPI document for working with The Weather Company (Weather Underground) API data.
This PHP package is automatically generated by the Swagger Codegen project:
- API version: 0.1.0
- Build package: io.swagger.codegen.languages.PhpClientCodegen
PHP 5.5 and later
To install the bindings via Composer, add the following to composer.json
:
{
"repositories": [
{
"type": "git",
"url": "https://github.com//.git"
}
],
"require": {
"/": "*@dev"
}
}
Then run composer install
Download the files and include autoload.php
:
require_once('/path/to/SwaggerClient-php/vendor/autoload.php');
To run the unit tests:
composer install
./vendor/bin/phpunit
Please follow the installation procedure and then run the following:
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure API key authorization: APIKeyQueryParam
$config = Swagger\Client\Configuration::getDefaultConfiguration()->setApiKey('apiKey', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('apiKey', 'Bearer');
$apiInstance = new Swagger\Client\Api\PWSObservationsApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client(),
$config
);
$station_id = "station_id_example"; // string | The PWS station ID
$units = "units_example"; // string | Unit type
$format = "json"; // string |
$numeric_precision = "numeric_precision_example"; // string | Optional parameter. Set to ‘decimal’ to ensure data is returned in decimal format when needed. Will return integers if this value is not used.
try {
$result = $apiInstance->observationsAllOneDay($station_id, $units, $format, $numeric_precision);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling PWSObservationsApi->observationsAllOneDay: ', $e->getMessage(), PHP_EOL;
}
?>
All URIs are relative to https://api.weather.com/v2/pws
Class | Method | HTTP request | Description |
---|---|---|---|
PWSObservationsApi | observationsAllOneDay | GET /observations/all/1day | |
PWSObservationsApi | observationsCurrent | GET /observations/current |
- Type: API key
- API key parameter name: apiKey
- Location: URL query string