Fetch Weather Data
curl --request POST \
--url https://api.example.com/weatherdata/fetchimport requests
url = "https://api.example.com/weatherdata/fetch"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://api.example.com/weatherdata/fetch', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/weatherdata/fetch",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/weatherdata/fetch"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/weatherdata/fetch")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/weatherdata/fetch")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_bodyWeather Data
Fetch Weather Data
Fetch weather data from an external source and persist it
POST
/
weatherdata
/
fetch
Fetch Weather Data
curl --request POST \
--url https://api.example.com/weatherdata/fetchimport requests
url = "https://api.example.com/weatherdata/fetch"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://api.example.com/weatherdata/fetch', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/weatherdata/fetch",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/weatherdata/fetch"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/weatherdata/fetch")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/weatherdata/fetch")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_bodyPOST /weatherdata/fetch
Fetch weather data from a supported external source (e.g., NSRDB, PVGIS), validate the retrieved arrays, and save the result as a new weather data record. This is the server-side fetch path — usePOST /weatherdata instead if you already have weather arrays to upload directly.
Notes
- Requires a valid JWT with write access.
- Required fields:
source(the external provider identifier),latitude(-90 to 90), andlongitude(-180 to 180). nameis optional; if omitted, a default name is generated from the source and coordinates (e.g.,"NSRDB 35.0000,-106.0000").- Additional source-specific parameters can be passed as extra fields in the request body and are forwarded to the fetch provider.
- Returns 400 if the external source returns invalid or inconsistent data.
- Returns 502 if the external source is unreachable or returns an unexpected error.
- The
weatherDataSourceon the created record reflects the provider name returned by the fetch service.
The fetched weather data is not automatically linked to a location. After creation, associate it with a location by referencing it during energy model configuration, or create it inline via
POST /locations with a nested weatherData object.- See
POST /weatherdatato create weather data from your own arrays. - See
GET /weatherdata/{weather_data_id}to retrieve the fetched record.
