Listing your continuous forecasts¶
This section provides an example of how to retrieve your continuous forecasts, submitted to Predico.
API Endpoints:¶
To interact with the Predico API and retrieve information about your submissions and respective submitted forecast time-series, you can use the following endpoint:
- GET
/api/v1/data/continuous-forecasts
- Retrieve your submitted continuous forecasts.
Access Token Required
An access token must be included in the Authorization
header of your request. If you haven't obtained an access token yet, please refer to the Authentication section.
Retrieving your continuous forecasts:¶
Here's how you can retrieve the list your continuous forecasts (historical or future).
import requests
# Authenticate via `/token` endpoint
access_token = "your_access_token_here"
headers = {
'Authorization': f'Bearer {access_token}',
'Accept': 'application/json'
}
# Challenge resource name.
resource_name = "wind_farm_1"
# Retrieve datetime range:
start_datetime = "2025-01-01T00:00:00Z"
end_datetime = "2026-01-01T00:00:00Z"
# Get challenges target resource identifier (UUID)
# (this is also available via the /market/challenge/ endpoint )
response = requests.get(
url='https://predico-elia.inesctec.pt/api/v1/user/resource',
params={'resource_name': resource_name},
headers=headers
)
# Check if the request was successful
if response.status_code == 200:
resources = response.json()
else:
print("Failed to retrieve resource data.")
print(f"Status code: {response.status_code}")
print(f"Response: {response.content}")
exit()
# Get resource ID:
resource_id = resources["data"][0]["id"]
print("Resource ID:", resource_id)
# Download continuous forecasts data for this resource:
params = {
"resource": resource_id,
"start_date": start_datetime,
"end_date": end_datetime
}
next_url = "https://predico-elia.inesctec.pt/api/v1/data/continuous-forecasts"
dataset = []
# -- Note: This will stop once all the samples are retrieved.
# -- next_url indicates the URL of the next page (pagination) to be requested)
while next_url is not None:
print(f"Requesting data...\n{next_url}") # This may take a while
response = requests.get(url=next_url, params=params, headers=headers)
print("Response status code:", response.status_code)
# Check if the request was successful
if response.status_code != 200:
print("Failed to retrieve forecasts.")
print(f"Status code: {response.status_code}")
print(f"Response: {response.content}")
exit("Exiting...")
else:
dataset += response.json()["data"]["results"]
next_url = response.json()["data"]["next"]
# -- Note: This will stop once all the samples are retrieved.
print("-"*79)
print(f"Retrieved {len(dataset)} records")
print("Continuous forecasts data (first 10 records preview):")
print(dataset[:10])
JSON Example Response¶
After running the example script, you will have access your forecasted time-series. Note that we only store the latest forecast you have submitted for each timestamp.
If no data is received, please confirm if you are requesting data for the right resource identifier.
Click to view Example Response
{
"code": 200,
"data": {
"count": 348,
"next": null,
"previous": null,
"results": [
{
"datetime": "2025-04-26T17:00:00Z",
"variable": "q10",
"value": 0,
"registered_at": "2025-04-26T15:59:41.472099Z"
}
]
}
}
What's next?¶
Learn how to list your submission scores on the Predico platform in the Listing Session Submission Scores section.