Introduction
Welcome to EDF Store & Forecast API v2 documentation !
We have tried to make this documentation user-friendly and example-filled, but if you have any questions, please head to our support team: support@edf-sf.com.
Some major changes to production category were introduced in version 2 of the API, as well as a new site category. The documentation for version 1 of the API can be found here
ID
This section focuses on ids and their description.
{
"id": "ess-1-p",
"description": "ess id 1 - active power"
}
| Attribute | Type | Description |
|---|---|---|
| id | string | ID of the record |
| description | string | description of the record |
Add IDs description
Example
curl --cacert ca.cert.pem --cert cert.pem --key key.pem
-X PUT -H "Content-Type: application/json" -d
'{
"production": {
"statuses": [
{
"id": "ess-1-state",
"description": "ess id 1 - state"
}
]
}
}' "https://api-preprod.edf-sf.com/v2/100/site"
{
"status_code": 1000,
"status_message": "success"
}
HTTP Request
PUT https://api.edf-sf.com/v2/<site_id>/site
URL Parameters
| Attribute | Type | Description |
|---|---|---|
| site_id | uint | requested site ID |
Body
| Attribute | Type | Description |
|---|---|---|
| production | object | contains metrics and statuses fields which are both array of ID objects |
| forecasts | array | array of ID objects |
| commitments | array | array of ID objects |
| tariffs | array | array of ID objects |
Response
| Attribute | Type | Description |
|---|---|---|
| status_code | uint | API status code |
| status_message | string | API status message |
Production
Production types
Supported production type
Metric
{
"id": "ess-1-p",
"values": [
{
"timestamp": 1601624896000,
"value": -491.2
}
]
}
| Attribute | Type | Description |
|---|---|---|
| id | string | ID of metric |
| values | array | array of metric value objects |
Metric value
| Attribute | Type | Description |
|---|---|---|
| timestamp | uint64 | timestamp in ms in Unix format |
| value | float64 | value of metric record |
Status
{
"id": "ess-1-state",
"values": [
{
"timestamp": 1601624896000,
"value": 3
}
]
}
| Attribute | Type | Description |
|---|---|---|
| id | string | ID of status |
| values | array | array of status value objects |
Status value
| Attribute | Type | Description |
|---|---|---|
| timestamp | uint64 | timestamp in ms in Unix format |
| value | uint32 | value of status record |
Get production data
Example
curl --cacert ca.cert.pem --cert cert.pem --key key.pem
"https://api-preprod.edf-sf.com/v2/100/production/status/ess-1-state"
{
"status_code": 1000,
"status_message": "success",
"results": [
{
"id": "ess-1-state",
"values": [
{
"timestamp": 1601624896000,
"value": 1
}
]
}
]
}
curl --cacert ca.cert.pem --cert cert.pem --key key.pem
"https://api-preprod.edf-sf.com/v2/100/production/metric/ess-1-p?from=1601624894000&to=1601624897000"
Example
{
"status_code": 1000,
"status_message": "success",
"results": [
{
"id": "ess-1-p",
"values": [
{
"timestamp": 1601624894000,
"value": -494.7
},
{
"timestamp": 1601624895000,
"value": -492.6
},
{
"timestamp": 1601624896000,
"value": -491.2
}
]
}
]
}
HTTP Request
GET https://api.edf-sf.com/v2/<site_id>/production/<production_type>/<id>
URL Parameters
| Parameter | Type | Description |
|---|---|---|
| site_id | uint | requested site ID |
| production_type | string | requested production type |
| id | string | requested ID |
Example
curl --cacert ca.cert.pem --cert cert.pem --key key.pem
-H "Content-Type: application/json" -d
'{
"ids": ["ess-1-p", "ess-1-q"]
}'
"https://api-preprod.edf-sf.com/v2/100/production/metric?from=1601624894000&to=1601624897000"
{
"status_code": 1000,
"status_message": "success",
"results": [
{
"id": "ess-1-p",
"values": [
{
"timestamp": 1601624894000,
"value": -494.7
},
{
"timestamp": 1601624895000,
"value": -492.6
},
{
"timestamp": 1601624896000,
"value": -491.2
}
]
},
{
"id": "ess-1-q",
"values": [
{
"timestamp": 1601624894000,
"value": -2.4
},
{
"timestamp": 1601624895000,
"value": -2.5
},
{
"timestamp": 1601624896000,
"value": -2.6
}
]
}
]
}
Body
| Attribute | Type | Description |
|---|---|---|
| ids | array | array of ids to be requested |
Query Parameters
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
| from | uint64 | no | filter records from this ms timestamp - use with to |
| to | uint64 | no | filter records to this ms timestamp - use with from |
| agg | string | no | aggregate records with min, max or avg function - use with from, to and agg |
| period | string | no | aggregate records over this duration (ex. 30s, 15m or 1h) - use with agg |
Response
| Attribute | Type | Description |
|---|---|---|
| status_code | uint | API status code |
| status_message | string | API status message |
| results | array | array of metric/status objects |
Forecast
The forecast endpoint can be used to GET or PUT forecast data for a given site.
Forecasts are stored as vectors of forecast periods.
Forecast periods obey the left convention (or beginning convention), which means that a forecast period is effective starting from its timestamp until the timestamp of the next forecast period.
Forecast attributes:
| Attribute | Type | Unit | Description |
|---|---|---|---|
| creation_timestamp | unsigned int | ms | forecast generation time (UTC timestamp) |
| id | unsigned int | - | forecast id |
| values | list | - | forecast periods list (see forecast types section for more details on forecast periods attributes) |
Get forecast
GET method on this endpoint returns forecast vector for the requested site ID, forecast type and forecast ID.
GET solar forecast example:
curl --cacert ca.cert.pem --cert cert.pem --key key.pem
"https://api-preprod.edf-sf.com/v2/100/forecast/solar/1?from=1535104800000&to=1535106600000"
The above command returns JSON structured like this:
{
"status_code": 1000,
"status_message": "success",
"results": [
{
"creation_timestamp": 1535104800000,
"id": 1,
"values": [
{
"timestamp": 1535104800000,
"p": 1572.64,
"quality": 1
},
{
"timestamp": 1535106600000,
"p": 1650.94,
"quality": 1
}
]
}
]
}
Forecast vectors can be filtered according to their creation date with generated-after and generated-before parameters. A selected forecast vector can be filtered with from, to parameters.
See examples to get a visual example.
HTTP Request
GET https://api.edf-sf.com/v2/<site_id>/forecast/<forecast_type>/<forecast_id>
URL Parameters
| Parameter | Type | Description |
|---|---|---|
| site_id | unsigned int | requested site ID |
| forecast_type | string | forecast type |
| forecast_id | unsigned int | forecast ID |
Query Parameters
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
| generated-after | unsigned int | no | filter forecast created after this ms timestamp - use with generated-before |
| generated-before | unsigned int | no | filter forecast created before this ms timestamp - use with generated-after |
| generate-all | bool | no | if set to true, request returns all vectors in [generated-after; generated-before[, otherwise only the latest in the considered interval - use with generated-after and generated-before |
| from | unsigned int | no | filter records from this ms timestamp - use with to |
| to | unsigned int | no | filter records to this ms timestamp - use with from |
| agg | string | no | aggregate records with min, max or avg function - use with from, to and agg |
| period | string | no | aggregate records over this duration (ex. 30s, 15m or 1h) - use with agg |
Put forecast
PUT method on this endpoint pushes forecast vectors for the given site ID and forecast type. Several forecast vectors with different forecast IDs can be pushed in a single request.
PUT wind forecast example:
curl --cacert ca.cert.pem --cert cert.pem --key key.pem
-X PUT -H "Content-Type: application/json" -d
'{
"values": [
{
"creation_timestamp": 1535104800000,
"id": 1,
"values": [
{
"timestamp": 1535104800000,
"p": 1572.64,
"quality": 1
},
{
"timestamp": 1535106600000,
"p": 1650.94,
"quality": 1
}
]
}
]
}' "https://api-preprod.edf-sf.com/v2/100/forecast/wind"
The above command returns JSON structured like this:
{
"status_code": 1000,
"status_message": "success",
}
HTTP Request
PUT https://api.edf-sf.com/v2/<site_id>/forecast/<forecast_type>
URL Parameters
| Parameter | Type | Description |
|---|---|---|
| site_id | unsigned int | requested site ID |
| forecast_type | string | forecast type |
Forecast types
Demand
Example:
{
"timestamp": 1535104800000,
"p": 411.08,
"quality": 1
}
Forecast type: demand
| Attribute | Type | Unit | Description |
|---|---|---|---|
| timestamp | unsigned int | ms | forecast UTC timestamp |
| p | float | kW | demand forecast |
| quality | unsigned int | - | forecast quality |
Solar
Example:
{
"timestamp": 1535104800000,
"p": 350.66,
"quality": 1
}
Forecast type: solar
| Attribute | Type | Unit | Description |
|---|---|---|---|
| timestamp | unsigned int | ms | forecast UTC timestamp |
| p | float | kW | solar production forecast |
| quality | unsigned int | - | forecast quality |
Wind
Example:
{
"timestamp": 1535104800000,
"p": 1475.58,
"quality": 1
}
Forecast type: wind
| Attribute | Type | Unit | Description |
|---|---|---|---|
| timestamp | unsigned int | ms | forecast UTC timestamp |
| p | float | kW | wind production forecast |
| quality | unsigned int | - | forecast quality |
Aggregate
Example:
{
"timestamp": 1535104800000,
"p": 627.34,
"quality": 1
}
Forecast type: aggregate
| Attribute | Type | Unit | Description |
|---|---|---|---|
| timestamp | unsigned int | ms | forecast UTC timestamp |
| p | float | kW | production forecast |
| quality | unsigned int | - | forecast quality |
Commitment
The commitment endpoint can be used to GET or PUT commitment data for a given site.
Commitments are stored as vectors of commitment periods.
Commitment periods obey the left convention (or beginning convention), which means that a commitment period is effective starting from its timestamp until the timestamp of the next commitment period.
Commitment attributes:
| Attribute | Type | Unit | Description |
|---|---|---|---|
| creation_timestamp | unsigned int | ms | commitment generation time (UTC timestamp) |
| id | unsigned int | - | commitment id |
| quality | unsigned int | - | quality of the forecast used to generate the commitment |
| values | list | - | commitment periods list |
Commitment period attributes:
| Attribute | Type | Unit | Description |
|---|---|---|---|
| timestamp | unsigned int | ms | commitment period start time (UTC timestamp) |
| value | float | - | commitment value, unit depends on the commitment (i.e. kW, kvar, kWh) |
Get commitment
GET method on this endpoint returns commitment vector for the requested site ID and commitment ID.
GET commitment example:
curl --cacert ca.cert.pem --cert cert.pem --key key.pem
"https://api-preprod.edf-sf.com/v2/100/commitment/1?from=1535104800000&to=1535106600000"
The above command returns JSON structured like this:
{
"status_code": 1000,
"status_message": "success",
"results": [
{
"creation_timestamp": 1535104800000,
"id": 1,
"quality": 1,
"values": [
{
"timestamp": 1535104800000,
"value": 1100.0
},
{
"timestamp": 1535106600000,
"value": 950.4
}
]
}
]
}
Commitment vectors can be selected according to their creation date with generated-after and generated-before parameters. A selected commitment vector can be filtered with from, to parameters.
See examples to get a visual example.
HTTP Request
GET https://api.edf-sf.com/v2/<site_id>/commitment/<commitment_id>
URL Parameters
| Parameter | Type | Description |
|---|---|---|
| site_id | unsigned int | requested site ID |
| commitment_id | unsigned int | commitment ID |
Query Parameters
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
| generated-after | unsigned int | no | filter commitment created after this ms timestamp - use with generated-before |
| generated-before | unsigned int | no | filter commitment created before this ms timestamp - use with generated-after |
| generate-all | bool | no | if set to true, request returns all vectors in [generated-after; generated-before[, otherwise only the latest in the considered interval - use with generated-after and generated-before |
| from | unsigned int | no | filter records from this ms timestamp - use with to |
| to | unsigned int | no | filter records to this ms timestamp - use with from |
| agg | string | no | aggregate records with min, max or avg function - use with from, to and agg |
| period | string | no | aggregate records over this duration (ex. 30s, 15m or 1h) - use with agg |
Put commitment
PUT method on this endpoint pushes commitment vectors for the given site ID. Several commitment vectors with different commitment ID can be pushed in a single request.
PUT commitment example:
curl --cacert ca.cert.pem --cert cert.pem --key key.pem
-X PUT -H "Content-Type: application/json" -d
'{
"values": [
{
"creation_timestamp": 1535104800000,
"id": 1,
"quality": 1,
"values": [
{
"timestamp": 1535104800000,
"value": 1100.0
},
{
"timestamp": 1535106600000,
"value": 950.4
}
]
}
]
}' "https://api-preprod.edf-sf.com/v2/100/commitment"
The above command returns JSON structured like this:
{
"status_code": 1000,
"status_message": "success"
}
HTTP Request
PUT https://api.edf-sf.com/v2/<site_id>/commitment
URL Parameters
| Parameter | Type | Description |
|---|---|---|
| site_id | unsigned int | requested site ID |
Tariff
The tariff endpoint can be used to GET or PUT tariff data for a given site.
Tariffs are stored as vectors of tariff periods.
Tariff periods obey the left convention (or beginning convention), which means that a tariff period is effective starting from its timestamp until the timestamp of the next tariff period.
Tariff attributes:
| Parameter | Type | Unit | Description |
|---|---|---|---|
| id | unsigned int | - | tariff id |
| values | list | - | tariff periods list |
Tariff period attributes:
| Parameter | Type | Unit | Description |
|---|---|---|---|
| timestamp | unsigned int | ms | tariff period start time (UTC timestamp) |
| label | string | kW | tariff period label, used to identify specific period (i.e. on-peak) |
| value | float | - | tariff period value, unit depends on the tariff (currency/kW or currency/kWh) |
Example:
{
"id": 1,
"values": [
{
"timestamp": 1535104800000,
"label": "on-peak",
"value": 9.85
}
]
}
Get tariff
GET method on this endpoint returns tariff periods for the requested site ID and tariff ID.
GET tariff example:
curl --cacert ca.cert.pem --cert cert.pem --key key.pem
"https://api-preprod.edf-sf.com/v2/100/tariff/1?from=1535104800000&to=1535107000000"
The above command returns JSON structured like this:
{
"status_code": 1000,
"status_message": "success",
"results": [
{
"id": 1,
"values": [
{
"timestamp": 1540486800000,
"label": "on-peak",
"value": 9.85
},
{
"timestamp": 1540501200000,
"label": "off-peak",
"value": 5.2
},
{
"timestamp": 1540573200000,
"label": "on-peak",
"value": 9.85
},
{
"timestamp": 1540587600000,
"label": "off-peak",
"value": 5.2
}
]
}
]
}
Tariff periods can be filtered with from, to parameters.
HTTP Request
GET https://api.edf-sf.com/v2/<site_id>/tariff/<tariff_id>
URL Parameters
| Parameter | Type | Description |
|---|---|---|
| site_id | unsigned int | requested site ID |
| tariff_id | unsigned int | tariff ID |
Query Parameters
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
| from | unsigned int | no | filter records from this ms timestamp - use with to |
| to | unsigned int | no | filter records to this ms timestamp - use with from |
Put tariff
PUT method on this endpoint pushes tariff periods for the requested site ID. Several tariffs periods with different tariff IDs can be pushed in a single request.
PUT tariff example:
curl --cacert ca.cert.pem --cert cert.pem --key key.pem
-X PUT -H "Content-Type: application/json" -d
'{
"values": [
{
"id": 1,
"values": [
{
"timestamp": 1540486800000,
"label": "on-peak",
"value": 9.85
},
{
"timestamp": 1540501200000,
"label": "off-peak",
"value": 5.2
}
]
}
]
}' "https://api-preprod.edf-sf.com/v2/100/tariff"
The above command returns JSON structured like this:
{
"status_code": 1000,
"status_message": "success"
}
HTTP Request
PUT https://api.edf-sf.com/v2/<site_id>/tariff
URL Parameters
| Parameter | Type | Description |
|---|---|---|
| site_id | unsigned int | requested site ID |
Status codes
HTTP status codes
Here are the HTTP status codes that can be returned by our API:
| Status | Description | Returned when |
|---|---|---|
| 200 | OK | GET request succeeded |
| 201 | Created | PUT request succeeded |
| 206 | Partial content | GET request response content is incomplete |
| 400 | Bad request | requested id is unknown, parameters are not consistent or payload is malformed |
| 403 | Forbidden | client certificate does not have the necessary permissions for the requested resource |
| 404 | Not found | endpoint requested does not match with EDF S&F API endpoints pattern |
| 405 | Method Not Allowed | request HTTP method is not GET or PUT |
| 500 | Internal server error | something went wrong on EDF S&F API server side |
API status codes
Here are the API status codes that can be returned by our API in response payloads:
| Status | Description | Returned when |
|---|---|---|
| 1000 | success | request succeeded |
| 1001 | partial response | GET request response content is incomplete. Response has been truncated because the request returned too many records |
| 1101 | invalid endpoint | endpoint requested is invalid |
| 1102 | invalid method | request HTTP method is not GET or PUT |
| 1103 | invalid header | request header is missing or invalid |
| 1104 | invalid site_id | site_id used in request is invalid |
| 1105 | invalid category | category in request endpoint is not equipment, forecast, commitment or tariff |
| 1106 | invalid type | equipment or forecast type used in request is invalid |
| 1107 | invalid id | equipment, forecast, commitment or tariff id used in request is invalid |
| 1200 | invalid parameters | parameters combination used in request is invalid |
| 1201 | invalid from | from parameter used in request is invalid |
| 1202 | invalid to | to parameter used in request is invalid |
| 1203 | invalid generated-after | generated-after parameter used in request is invalid |
| 1204 | invalid generated-before | generated-before parameter used in request is invalid |
| 1205 | invalid agg | agg parameter used in request is invalid |
| 1206 | invalid period | period parameter used in request is invalid |
| 1301 | payload encoding error | server failed to decode the PUT request payload |
| 1302 | payload empty error | PUT request payload is empty |
| 1303 | payload content error | PUT request payload content is invalid |
| 1400 | permission error | client certificate is missing or does not have the necessary permissions to access the requested resource |
| 1500 | server error | EDF S&F API server internal error |
Examples
Forecast and commitments parameters
- generated_before , generated_after:

The vector extracted is the most recent created in the [generated_after, generated_before[ interval.
- from, to:

The vector contains exclusively data with timestamps in the [from, to[ interval.
Python
Python GET request example on
productionendpoint:
import requests
# certification authority certificate
ca_cert = 'ca.cert.pem'
# client certificate and private key
client_certs = ('cert.pem', 'pkey.pem')
# request to production endpoint for site 100 and metric ess-1-p
endpoint = "https://api-preprod.edf-sf.com/v2/100/production/metric/ess-1-p"
headers = {
'Accept': 'application/json',
}
# request data interval [2018-11-10 12:00:00 UTC, 2018-11-12 20:00:00 UTC[
# aggregated with average function over 1mn periods
params = {
'from': 1541851200000,
'to': 1541880000000,
'agg': 'avg',
'period': '1m'
}
r = requests.get(endpoint,
verify=ca_cert,
cert=client_certs,
headers=headers,
params=params)
if r.status_code != 200:
print('request failed: unexpected HTTP status ({})'.format(r.status_code))
else:
print(r.json())

