NAV
  • Introduction
  • ID
  • Production
  • Forecast
  • Commitment
  • Tariff
  • Status codes
  • Examples
  • 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"
    }
    
    AttributeTypeDescription
    idstringID of the record
    descriptionstringdescription 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

    AttributeTypeDescription
    site_iduintrequested site ID

    Body

    AttributeTypeDescription
    productionobjectcontains metrics and statuses fields which are both array of ID objects
    forecastsarrayarray of ID objects
    commitmentsarrayarray of ID objects
    tariffsarrayarray of ID objects

    Response

    AttributeTypeDescription
    status_codeuintAPI status code
    status_messagestringAPI status message

    Production

    Production types

    Supported production type

    Metric

    {
      "id": "ess-1-p",
      "values": [
        {
          "timestamp": 1601624896000,
          "value": -491.2
        }
      ]
    }
    
    AttributeTypeDescription
    idstringID of metric
    valuesarrayarray of metric value objects

    Metric value

    AttributeTypeDescription
    timestampuint64timestamp in ms in Unix format
    valuefloat64value of metric record

    Status

    {
      "id": "ess-1-state",
      "values": [
        {
          "timestamp": 1601624896000,
          "value": 3
        }
      ]
    }
    
    AttributeTypeDescription
    idstringID of status
    valuesarrayarray of status value objects

    Status value

    AttributeTypeDescription
    timestampuint64timestamp in ms in Unix format
    valueuint32value 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

    ParameterTypeDescription
    site_iduintrequested site ID
    production_typestringrequested production type
    idstringrequested 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

    AttributeTypeDescription
    idsarrayarray of ids to be requested

    Query Parameters

    ParameterTypeMandatoryDescription
    fromuint64nofilter records from this ms timestamp - use with to
    touint64nofilter records to this ms timestamp - use with from
    aggstringnoaggregate records with min, max or avg function - use with from, to and agg
    periodstringnoaggregate records over this duration (ex. 30s, 15m or 1h) - use with agg

    Response

    AttributeTypeDescription
    status_codeuintAPI status code
    status_messagestringAPI status message
    resultsarrayarray 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:

    AttributeTypeUnitDescription
    creation_timestampunsigned intmsforecast generation time (UTC timestamp)
    idunsigned int-forecast id
    valueslist-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

    ParameterTypeDescription
    site_idunsigned intrequested site ID
    forecast_typestringforecast type
    forecast_idunsigned intforecast ID

    Query Parameters

    ParameterTypeMandatoryDescription
    generated-afterunsigned intnofilter forecast created after this ms timestamp - use with generated-before
    generated-beforeunsigned intnofilter forecast created before this ms timestamp - use with generated-after
    generate-allboolnoif 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
    fromunsigned intnofilter records from this ms timestamp - use with to
    tounsigned intnofilter records to this ms timestamp - use with from
    aggstringnoaggregate records with min, max or avg function - use with from, to and agg
    periodstringnoaggregate 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

    ParameterTypeDescription
    site_idunsigned intrequested site ID
    forecast_typestringforecast type

    Forecast types

    Demand

    Example:

    {
      "timestamp": 1535104800000,
      "p": 411.08,
      "quality": 1
    }
    

    Forecast type: demand

    AttributeTypeUnitDescription
    timestampunsigned intmsforecast UTC timestamp
    pfloatkWdemand forecast
    qualityunsigned int-forecast quality

    Solar

    Example:

    {
      "timestamp": 1535104800000,
      "p": 350.66,
      "quality": 1
    }
    

    Forecast type: solar

    AttributeTypeUnitDescription
    timestampunsigned intmsforecast UTC timestamp
    pfloatkWsolar production forecast
    qualityunsigned int-forecast quality

    Wind

    Example:

    {
      "timestamp": 1535104800000,
      "p": 1475.58,
      "quality": 1
    }
    

    Forecast type: wind

    AttributeTypeUnitDescription
    timestampunsigned intmsforecast UTC timestamp
    pfloatkWwind production forecast
    qualityunsigned int-forecast quality

    Aggregate

    Example:

    {
      "timestamp": 1535104800000,
      "p": 627.34,
      "quality": 1
    }
    

    Forecast type: aggregate

    AttributeTypeUnitDescription
    timestampunsigned intmsforecast UTC timestamp
    pfloatkWproduction forecast
    qualityunsigned 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:

    AttributeTypeUnitDescription
    creation_timestampunsigned intmscommitment generation time (UTC timestamp)
    idunsigned int-commitment id
    qualityunsigned int-quality of the forecast used to generate the commitment
    valueslist-commitment periods list

    Commitment period attributes:

    AttributeTypeUnitDescription
    timestampunsigned intmscommitment period start time (UTC timestamp)
    valuefloat-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

    ParameterTypeDescription
    site_idunsigned intrequested site ID
    commitment_idunsigned intcommitment ID

    Query Parameters

    ParameterTypeMandatoryDescription
    generated-afterunsigned intnofilter commitment created after this ms timestamp - use with generated-before
    generated-beforeunsigned intnofilter commitment created before this ms timestamp - use with generated-after
    generate-allboolnoif 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
    fromunsigned intnofilter records from this ms timestamp - use with to
    tounsigned intnofilter records to this ms timestamp - use with from
    aggstringnoaggregate records with min, max or avg function - use with from, to and agg
    periodstringnoaggregate 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

    ParameterTypeDescription
    site_idunsigned intrequested 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:

    ParameterTypeUnitDescription
    idunsigned int-tariff id
    valueslist-tariff periods list

    Tariff period attributes:

    ParameterTypeUnitDescription
    timestampunsigned intmstariff period start time (UTC timestamp)
    labelstringkWtariff period label, used to identify specific period (i.e. on-peak)
    valuefloat-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

    ParameterTypeDescription
    site_idunsigned intrequested site ID
    tariff_idunsigned inttariff ID

    Query Parameters

    ParameterTypeMandatoryDescription
    fromunsigned intnofilter records from this ms timestamp - use with to
    tounsigned intnofilter 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

    ParameterTypeDescription
    site_idunsigned intrequested site ID

    Status codes

    HTTP status codes

    Here are the HTTP status codes that can be returned by our API:

    StatusDescriptionReturned when
    200OKGET request succeeded
    201CreatedPUT request succeeded
    206Partial contentGET request response content is incomplete
    400Bad requestrequested id is unknown, parameters are not consistent or payload is malformed
    403Forbiddenclient certificate does not have the necessary permissions for the requested resource
    404Not foundendpoint requested does not match with EDF S&F API endpoints pattern
    405Method Not Allowedrequest HTTP method is not GET or PUT
    500Internal server errorsomething 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:

    StatusDescriptionReturned when
    1000successrequest succeeded
    1001partial responseGET request response content is incomplete. Response has been truncated because the request returned too many records
    1101invalid endpointendpoint requested is invalid
    1102invalid methodrequest HTTP method is not GET or PUT
    1103invalid headerrequest header is missing or invalid
    1104invalid site_idsite_id used in request is invalid
    1105invalid categorycategory in request endpoint is not equipment, forecast, commitment or tariff
    1106invalid typeequipment or forecast type used in request is invalid
    1107invalid idequipment, forecast, commitment or tariff id used in request is invalid
    1200invalid parametersparameters combination used in request is invalid
    1201invalid fromfrom parameter used in request is invalid
    1202invalid toto parameter used in request is invalid
    1203invalid generated-aftergenerated-after parameter used in request is invalid
    1204invalid generated-beforegenerated-before parameter used in request is invalid
    1205invalid aggagg parameter used in request is invalid
    1206invalid periodperiod parameter used in request is invalid
    1301payload encoding errorserver failed to decode the PUT request payload
    1302payload empty errorPUT request payload is empty
    1303payload content errorPUT request payload content is invalid
    1400permission errorclient certificate is missing or does not have the necessary permissions to access the requested resource
    1500server errorEDF S&F API server internal error

    Examples

    Forecast and commitments parameters

    The vector extracted is the most recent created in the [generated_after, generated_before[ interval.

    The vector contains exclusively data with timestamps in the [from, to[ interval.

    Python

    Python GET request example on production endpoint:

    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())