Get forecasts for workspace
Base URL: https://api.tensorenergy.jp/v1
Path: /forecasts/workspace
Method: GET
Query parameters
Field | Type | Description | Required |
---|---|---|---|
from | string | Specifies the starting time to retrieve generation forecasts from, expressed in the format 2006-01-02T15:04:05Z . | true |
to | string | Specifies the ending time for the interval to retrieve generation forecasts to, expressed in the format 2006-01-02T15:04:05Z . The interval between from and to cannot exceed 14 days. | true |
generation | string | Specifies the forecast generation time. Acceptable values are latest , dayAhead , or a timestamp. | false |
offset | integer | Specifies the offset from the generation forecast time slot in seconds. | false |
Response
The response is a non-nullable JSON object with the following fields:
Field | Type | Description |
---|---|---|
data | [ForecastSet] | null | Returned data from the query. If error is non-null, then this value will be null. |
error | Error | null | Any error returned from the query. If data is non-null, then this value will be null. |
ForecastSet Object
Field | Type | Description |
---|---|---|
datetime | string | Date and time for the slot, expressed as an ISO 8601 compliant UTC timestamp. |
total_kwh | float | Total amount of forecasted generation, expressed in kilowatt hour (kWh). |
values | array | Asset forecasted values for the slot. Each entry includes asset_id and value_kwh . |
Error object
Field | Type | Description |
---|---|---|
message | string | Message that explains what went wrong. |
code | internal_server_error | not_authorized | invalid_query_parameter | resource_not_found | Error code that occurred. |
Example request
- cURL
- Python
- Typescript
curl --request GET \
--url https://api.tensorenergy.jp/v1/forecasts/workspace?from=2024-01-01T00:00:00Z&to=2024-01-02T00:00:00Z&generation=latest&offset=3600 \
--header "authorization: Bearer ${API_TOKEN}"
import requests
API_URL = 'https://api.tensorenergy.jp/v1/forecasts/workspace?from=2024-01-01T00:00:00Z&to=2024-01-02T00:00:00Z&generation=latest&offset=3600'
API_TOKEN = 'YOUR_API_KEY'
headers = {
'authorization': f'Bearer {API_TOKEN}',
}
response = requests.get(API_URL, headers=headers)
print(response.json())
const API_URL = 'https://api.tensorenergy.jp/v1/forecasts/workspace?from=2024-01-01T00:00:00Z&to=2024-01-02T00:00:00Z&generation=latest&offset=3600'
const API_TOKEN = 'YOUR_API_KEY'
const fetchData = async () => {
try {
const response = await fetch(API_URL, {
method: 'GET',
headers: {
'authorization': `Bearer ${API_TOKEN}`
}
})
console.log(response)
} catch (error) {
console.error(error)
}
};
fetchData()
Example responses
Successful response
{
"data": [
{
"datetime": "2024-01-01T00:00:00Z",
"total_kwh": 100.5,
"values": [
{
"asset_id": "51d5ffcf-1347-4277-93e8-dfca140fe8b3",
"value_kwh": 10.1
},
{
"asset_id": "7c97f8f2-8d50-4a77-9282-f9a16387dcbf",
"value_kwh": 20.3
}
]
},
{
"datetime": "2024-01-01T01:00:00Z",
"total_kwh": 110.7,
"values": [
{
"asset_id": "51d5ffcf-1347-4277-93e8-dfca140fe8b3",
"value_kwh": 15.2
},
{
"asset_id": "7c97f8f2-8d50-4a77-9282-f9a16387dcbf",
"value_kwh": 25.4
}
]
}
],
"error": null
}
Error occurs during operation
{
"data": null,
"error": {
"message": "something went wrong during the process",
"code": "internal_server_error"
}
}
No forecasts available for the asset
{
"data": [],
"error": null
}