Skip to content

Get measurements for a meter point

Returns all the readings that were associated with a property using its meter point within a specified timeframe. At a high level, this API should be used when you need information about utility consumption or to query for a property's solar generation readings. The measurement API here should be used instead of the intervalReadings and dailyReadings account queries because it supports aggregation and filtering of readings as well as different timezones.

This endpoint can return pricing information for solar generation buybacks. It can also return an account's consumption costs; however, only if said account is on a wholesale agreement i.e., one with variable rates.

Filter what this endpoint returns by using the MeasurementTypedSourceInput input type.

Authentication Required

Requires account user level access or CAN_QUERY_PROPERTY_METERS permission.

Note

You can query for measurements using the AccountType or the PropertyType

Importantly, you may query for serveral aggregation levels by supplying a list of TypedSourceInputType to the typedOnly filter.

FIVE_MIN_INTERVAL ReadingFrequencyTypes is not supported in the ERCOT market.

Price estimates will be more accurate when you use smaller aggregation levels because less averaging of the pricing occurs.

Arguments

  • accountNumber: String!
  • startAt: DateTime
  • endAt: DateTime
  • startOn: Date
  • endOn: Date
  • timezone: String
  • only: [String]
  • typedOnly: [TypedSourceInputType!]
  • before: String
  • after: String
  • first: Int
  • last: Int

Returns

query property(
    $accountNumber: String!
    $activeFrom: DateTime
    $first: Int!
    $typedOnly: [TypedSourceInputType!]
    $startOn: Date
    $endOn: Date
    $startAt: DateTime
    $endAt: DateTime
    $timezone: String
) {
    account(accountNumber: $accountNumber) {
        properties(activeFrom: $activeFrom) {
            id
            measurements(
                first: $first
                typedOnly: $typedOnly
                startOn: $startOn
                endOn: $endOn
                startAt: $startAt
                endAt: $endAt
                timezone: $timezone
            ) {
                edges {
                    node {
                        source
                        value
                        unit
                        readAt
                        ... on IntervalMeasurementType {
                            startAt
                            endAt
                            accumulation
                            durationInSeconds
                        }
                    }
                }
                pageInfo {
                    hasNextPage
                    hasPreviousPage
                    startCursor
                    endCursor
                }
            }
        }
    }
}
1
2
3
4
5
6
7
8
9
# Input variables
{
    "input": {
        "accountNumber": "A-123456",
        "first": 10,
        "startAt": "2021-10-25T00:00:00-05:00"
        "endAt": "2021-10-30T00:00:00-05:00"
    }
}
query property(
    $accountNumber: String!
    $activeFrom: DateTime
    $first: Int!
    $typedOnly: [TypedSourceInputType!]
    $startOn: Date
    $endOn: Date
    $startAt: DateTime
    $endAt: DateTime
    $timezone: String
) {
    account(accountNumber: $accountNumber) {
        properties(activeFrom: $activeFrom) {
            id
            measurements(
                first: $first
                typedOnly: $typedOnly
                startOn: $startOn
                endOn: $endOn
                startAt: $startAt
                endAt: $endAt
                timezone: $timezone
            ) {
                edges {
                    node {
                        source
                        value
                        unit
                        readAt
                        ... on MeasurementType{
                            readAt
                            source
                            unit
                            value
                            metaData{
                                statistics{
                                    type
                                    label
                                    description
                                    costExclTax {
                                        estimatedAmount
                                        costCurrency
                                    }
                                    costInclTax {
                                        estimatedAmount
                                        costCurrency
                                    }
                                    value
                                    __typename
                                }
                                typedSource{
                                    readingDirection
                                    readingFrequencyType
                                    sourceIdentifier
                                    utility
                                }
                            }
                        }
                        ... on IntervalMeasurementType {
                            startAt
                            endAt
                            accumulation
                            durationInSeconds
                            metaData{
                                statistics{
                                    type
                                    label
                                    description
                                    costExclTax {
                                        estimatedAmount
                                        costCurrency
                                    }
                                    costInclTax {
                                        estimatedAmount
                                        costCurrency
                                    }
                                    value
                                    __typename
                                }
                                typedSource{
                                    readingDirection
                                    readingFrequencyType
                                    sourceIdentifier
                                    utility
                                }
                            }
                        }
                    }
                }
                pageInfo {
                    hasNextPage
                    hasPreviousPage
                    startCursor
                    endCursor
                }
            }
        }
    }
}
# Input variables
{
    "input": {
        "accountNumber": "A-123456",
        "first": 10,
        "startAt": "2021-10-25T00:00:00-05:00",
        "endAt": "2021-10-30T00:00:00-05:00",
        "timezone": "America/Chicago",
        "typedOnly": [
            {
                "utility": "ELECTRICITY",
                "readingFrequencyType": "FIFTEEN_MIN_INTERVAL",
                "readingDirection": "CONSUMPTION"
            }
        ]
    }
}

Examples

Without any source filter

query property(
    $accountNumber: String!
    $activeFrom: DateTime
    $first: Int!
    $typedOnly: [TypedSourceInputType!]
    $startOn: Date
    $endOn: Date
    $startAt: DateTime
    $endAt: DateTime
    $timezone: String
) {
    account(accountNumber: $accountNumber) {
        properties(activeFrom: $activeFrom) {
            id
            measurements(
                first: $first
                typedOnly: $typedOnly
                startOn: $startOn
                endOn: $endOn
                startAt: $startAt
                endAt: $endAt
                timezone: $timezone
            ) {
                edges {
                    node {
                        source
                        value
                        unit
                        readAt
                        ... on MeasurementType{
                            readAt
                            source
                            unit
                            value
                            metaData{
                                statistics{
                                    type
                                    label
                                    description
                                    costExclTax {
                                        estimatedAmount
                                        costCurrency
                                    }
                                    costInclTax {
                                        estimatedAmount
                                        costCurrency
                                    }
                                    value
                                    __typename
                                }
                                typedSource{
                                    readingDirection
                                    readingFrequencyType
                                    sourceIdentifier
                                    utility
                                }
                            }
                        }
                        ... on IntervalMeasurementType {
                            startAt
                            endAt
                            accumulation
                            durationInSeconds
                            metaData{
                                statistics{
                                    type
                                    label
                                    description
                                    costExclTax {
                                        estimatedAmount
                                        costCurrency
                                    }
                                    costInclTax {
                                        estimatedAmount
                                        costCurrency
                                    }
                                    value
                                    __typename
                                }
                                typedSource{
                                    readingDirection
                                    readingFrequencyType
                                    sourceIdentifier
                                    utility
                                }
                            }
                        }
                    }
                }
                pageInfo {
                    hasNextPage
                    hasPreviousPage
                    startCursor
                    endCursor
                }
            }
        }
    }
}
1
2
3
4
5
6
7
# Input variables
{
    "accountNumber": "A-123456",
    "first": 10,
    "startAt": "2021-10-25T00:00:00-05:00"
    "endAt": "2021-10-30T00:00:00-05:00"
}
{
    "data": {
        "account": {
            "properties": [
                {
                    "id": "9065",
                    "measurements": {
                        "edges": [
                            {
                                "node": {
                                    "source": "meter_point.electricity.interval.meter_point.esi_id.1008900000000000000008.consumption",
                                    "value": "0.06200",
                                    "unit": "kWh",
                                    "readAt": "2021-10-25T05:15:00+00:00",
                                    "startAt": "2021-10-25T05:00:00+00:00",
                                    "endAt": "2021-10-25T05:15:00+00:00",
                                    "accumulation": null,
                                    "durationInSeconds": 900,
                                    "metaData": {
                                        "typedSource": {
                                            "readingDirection": "CONSUMPTION",
                                            "readingFrequencyType": "FIFTEEN_MIN_INTERVAL",
                                            "sourceIdentifier": "meter_point.esi_id.1008900000000000000008",
                                            "utility": "ELECTRICITY"
                                        }
                                    }
                                }
                            },
                            {
                                "node": {
                                    "source": "meter_point.electricity.interval.meter_point.esi_id.1008900000000000000008.consumption",
                                    "value": "0.06200",
                                    "unit": "kWh",
                                    "readAt": "2021-10-25T05:15:00+00:00",
                                    "startAt": "2021-10-25T05:00:00+00:00",
                                    "endAt": "2021-10-25T05:15:00+00:00",
                                    "accumulation": null,
                                    "durationInSeconds": 900,
                                    "metaData": {
                                        "statistics": [
                                            {
                                                "costExclTax": {
                                                    "estimatedAmount": "620.00000",
                                                    "costCurrency": "USD",
                                                },
                                                "costInclTax": null,
                                                "description": null,
                                                "label": null,
                                                "type": "CONSUMPTION_COST",
                                                "value": "0.06200",
                                                "__typename": "StatisticOutput",
                                            }
                                        ],
                                        "typedSource": {
                                            "readingDirection": "CONSUMPTION",
                                            "readingFrequencyType": "FIFTEEN_MIN_INTERVAL",
                                            "sourceIdentifier": "meter_point.esi_id.1008900000000000000008",
                                            "utility": "ELECTRICITY"
                                        }
                                    }
                                }
                            },
                            {
                                "node": {
                                    "source": "meter_point.electricity.interval.meter_point.esi_id.1008900000000000000008.consumption",
                                    "value": "0.32600",
                                    "unit": "kWh",
                                    "readAt": "2021-10-25T05:30:00+00:00",
                                    "startAt": "2021-10-25T05:15:00+00:00",
                                    "endAt": "2021-10-25T05:30:00+00:00",
                                    "accumulation": null,
                                    "durationInSeconds": 900,
                                    "metaData": {
                                        "statistics": [
                                            {
                                                "costExclTax": {
                                                    "estimatedAmount": "326.00000",
                                                    "costCurrency": "USD",
                                                },
                                                "costInclTax": null,
                                                "description": null,
                                                "label": null,
                                                "type": "CONSUMPTION_COST",
                                                "value": "0.32600",
                                                "__typename": "StatisticOutput",
                                            }
                                        ],
                                        "typedSource": {
                                            "readingDirection": "CONSUMPTION",
                                            "readingFrequencyType": "FIFTEEN_MIN_INTERVAL",
                                            "sourceIdentifier": "meter_point.esi_id.1008900000000000000008",
                                            "utility": "ELECTRICITY"
                                        }
                                    }
                                }
                            },
                            {
                                "node": {
                                    "source": "meter_point.electricity.interval.meter_point.esi_id.1008900000000000000008.consumption",
                                    "value": "0.32600",
                                    "unit": "kWh",
                                    "readAt": "2021-10-25T05:30:00+00:00",
                                    "startAt": "2021-10-25T05:15:00+00:00",
                                    "endAt": "2021-10-25T05:30:00+00:00",
                                    "accumulation": null,
                                    "durationInSeconds": 900,
                                    "metaData": {
                                        "statistics": [
                                            {
                                                "costExclTax": {
                                                    "estimatedAmount": "326.00000",
                                                    "costCurrency": "USD",
                                                },
                                                "costInclTax": null,
                                                "description": null,
                                                "label": null,
                                                "type": "CONSUMPTION_COST",
                                                "value": "0.32600",
                                                "__typename": "StatisticOutput",
                                            }
                                        ],
                                        "typedSource": {
                                            "readingDirection": "CONSUMPTION",
                                            "readingFrequencyType": "FIFTEEN_MIN_INTERVAL",
                                            "sourceIdentifier": "meter_point.esi_id.1008900000000000000008",
                                            "utility": "ELECTRICITY"
                                        }
                                    }
                                }
                            },
                            {
                                "node": {
                                    "source": "meter_point.electricity.interval.meter_point.esi_id.1008900000000000000008.consumption",
                                    "value": "0.04800",
                                    "unit": "kWh",
                                    "readAt": "2021-10-25T05:45:00+00:00",
                                    "startAt": "2021-10-25T05:30:00+00:00",
                                    "endAt": "2021-10-25T05:45:00+00:00",
                                    "accumulation": null,
                                    "durationInSeconds": 900,
                                    "metaData": {
                                        "statistics": [
                                            {
                                                "costExclTax": {
                                                    "estimatedAmount": "480.00000",
                                                    "costCurrency": "USD",
                                                },
                                                "costInclTax": null,
                                                "description": null,
                                                "label": null,
                                                "type": "CONSUMPTION_COST",
                                                "value": "0.04800",
                                                "__typename": "StatisticOutput",
                                            }
                                        ],
                                        "typedSource": {
                                            "readingDirection": "CONSUMPTION",
                                            "readingFrequencyType": "FIFTEEN_MIN_INTERVAL",
                                            "sourceIdentifier": "meter_point.esi_id.1008900000000000000008",
                                            "utility": "ELECTRICITY"
                                        }
                                    }
                                }
                            },
                            {
                                "node": {
                                    "source": "meter_point.electricity.interval.meter_point.esi_id.1008900000000000000008.consumption",
                                    "value": "0.04800",
                                    "unit": "kWh",
                                    "readAt": "2021-10-25T05:45:00+00:00",
                                    "startAt": "2021-10-25T05:30:00+00:00",
                                    "endAt": "2021-10-25T05:45:00+00:00",
                                    "accumulation": null,
                                    "durationInSeconds": 900,
                                    "metaData": {
                                        "statistics": [
                                            {
                                                "costExclTax": {
                                                    "estimatedAmount": "480.00000",
                                                    "costCurrency": "USD",
                                                },
                                                "costInclTax": null,
                                                "description": null,
                                                "label": null,
                                                "type": "CONSUMPTION_COST",
                                                "value": "0.04800",
                                                "__typename": "StatisticOutput",
                                            }
                                        ],
                                        "typedSource": {
                                            "readingDirection": "CONSUMPTION",
                                            "readingFrequencyType": "FIFTEEN_MIN_INTERVAL",
                                            "sourceIdentifier": "meter_point.esi_id.1008900000000000000008",
                                            "utility": "ELECTRICITY"
                                        }
                                    }
                                }
                            },
                            {
                                "node": {
                                    "source": "meter_point.electricity.interval.meter_point.esi_id.1008900000000000000008.consumption",
                                    "value": "0.05600",
                                    "unit": "kWh",
                                    "readAt": "2021-10-25T06:00:00+00:00",
                                    "startAt": "2021-10-25T05:45:00+00:00",
                                    "endAt": "2021-10-25T06:00:00+00:00",
                                    "accumulation": null,
                                    "durationInSeconds": 900,
                                    "metaData": {
                                        "statistics": [
                                            {
                                                "costExclTax": {
                                                    "estimatedAmount": "560.00000",
                                                    "costCurrency": "USD",
                                                },
                                                "costInclTax": null,
                                                "description": null,
                                                "label": null,
                                                "type": "CONSUMPTION_COST",
                                                "value": "0.05600",
                                                "__typename": "StatisticOutput",
                                            }
                                        ],
                                        "typedSource": {
                                            "readingDirection": "CONSUMPTION",
                                            "readingFrequencyType": "FIFTEEN_MIN_INTERVAL",
                                            "sourceIdentifier": "meter_point.esi_id.1008900000000000000008",
                                            "utility": "ELECTRICITY"
                                        }
                                    }
                                }
                            },
                            {
                                "node": {
                                    "source": "meter_point.electricity.interval.meter_point.esi_id.1008900000000000000008.consumption",
                                    "value": "0.05600",
                                    "unit": "kWh",
                                    "readAt": "2021-10-25T06:00:00+00:00",
                                    "startAt": "2021-10-25T05:45:00+00:00",
                                    "endAt": "2021-10-25T06:00:00+00:00",
                                    "accumulation": null,
                                    "durationInSeconds": 900,
                                    "metaData": {
                                        "statistics": [
                                            {
                                                "costExclTax": {
                                                    "estimatedAmount": "560.00000",
                                                    "costCurrency": "USD",
                                                },
                                                "costInclTax": null,
                                                "description": null,
                                                "label": null,
                                                "type": "CONSUMPTION_COST",
                                                "value": "0.05600",
                                                "__typename": "StatisticOutput",
                                            }
                                        ],
                                        "typedSource": {
                                            "readingDirection": "CONSUMPTION",
                                            "readingFrequencyType": "FIFTEEN_MIN_INTERVAL",
                                            "sourceIdentifier": "meter_point.esi_id.1008900000000000000008",
                                            "utility": "ELECTRICITY"
                                        }
                                    }
                                }
                            },
                            {
                                "node": {
                                    "source": "meter_point.electricity.interval.meter_point.esi_id.1008900000000000000008.consumption",
                                    "value": "0.55500",
                                    "unit": "kWh",
                                    "readAt": "2021-10-25T06:15:00+00:00",
                                    "startAt": "2021-10-25T06:00:00+00:00",
                                    "endAt": "2021-10-25T06:15:00+00:00",
                                    "accumulation": null,
                                    "durationInSeconds": 900,
                                    "metaData": {
                                        "statistics": [
                                            {
                                                "costExclTax": {
                                                    "estimatedAmount": "555.00000",
                                                    "costCurrency": "USD",
                                                },
                                                "costInclTax": null,
                                                "description": null,
                                                "label": null,
                                                "type": "CONSUMPTION_COST",
                                                "value": "0.55500",
                                                "__typename": "StatisticOutput",
                                            }
                                        ],
                                        "typedSource": {
                                            "readingDirection": "CONSUMPTION",
                                            "readingFrequencyType": "FIFTEEN_MIN_INTERVAL",
                                            "sourceIdentifier": "meter_point.esi_id.1008900000000000000008",
                                            "utility": "ELECTRICITY"
                                        }
                                    }
                                }
                            },
                            {
                                "node": {
                                    "source": "meter_point.electricity.interval.meter_point.esi_id.1008900000000000000008.consumption",
                                    "value": "0.55500",
                                    "unit": "kWh",
                                    "readAt": "2021-10-25T06:15:00+00:00",
                                    "startAt": "2021-10-25T06:00:00+00:00",
                                    "endAt": "2021-10-25T06:15:00+00:00",
                                    "accumulation": null,
                                    "durationInSeconds": 900,
                                    "metaData": {
                                        "statistics": [
                                            {
                                                "costExclTax": {
                                                    "estimatedAmount": "555.00000",
                                                    "costCurrency": "USD",
                                                },
                                                "costInclTax": null,
                                                "description": null,
                                                "label": null,
                                                "type": "CONSUMPTION_COST",
                                                "value": "0.55500",
                                                "__typename": "StatisticOutput",
                                            }
                                        ],
                                        "typedSource": {
                                            "readingDirection": "CONSUMPTION",
                                            "readingFrequencyType": "FIFTEEN_MIN_INTERVAL",
                                            "sourceIdentifier": "meter_point.esi_id.1008900000000000000008",
                                            "utility": "ELECTRICITY"
                                        }
                                    }
                                }
                            }
                        ],
                        "pageInfo": {
                            "hasNextPage": true,
                            "hasPreviousPage": false,
                            "startCursor": "YXJyYXljABCDEFGHaaW9uOjA=",
                            "endCursor": "YXJyYXljABCDEFGHaW9uOjk="
                        }
                    }
                }
            ]
        }
    }
}

Filtering for Specific Readings

If you want to filter for a particular source of reading, you can provide the typedOnly filter. This filter should be preferred over the soon to be depreciated only filter in all circumstances. The TypedSourceInputType is a required input.

Here are some examples of typed filters:

  • Query for consumption readings that are aggregated on a day-to-day basis.
"typedOnly": [
    {
        "readingFrequencyType": "DAILY",
        "readingDirection": "CONSUMPTION",
        "utility": "ELECTRICITY"
    }
]
  • Query for fifteen minute consumption readings.
"typedOnly": [
    {
        "readingFrequencyType": "FIFTEEN_MIN_INTERVAL",
        "readingDirection": "CONSUMPTION",
        "utility": "ELECTRICITY"
    }
]
  • Query for fifteen minute consumption readings aggregated by the hour.
"typedOnly": [
    {
        "readingFrequencyType": "HOUR_INTERVAL",
        "readingDirection": "CONSUMPTION",
        "utility": "ELECTRICITY"
    }
]
  • Recall you may query for multiple aggregations in the same query.
"typedOnly": [
    {
        "readingFrequencyType": "MONTH_INTERVAL",
        "readingDirection": "CONSUMPTION",
        "utility": "ELECTRICITY"
    },
    {
        "readingFrequencyType": "QUARTER_INTERVAL",
        "readingDirection": "CONSUMPTION",
        "utility": "ELECTRICITY"
    }
]
  • You may query for aggregations and daily readings in the same query as well.
"typedOnly": [
    {
        "readingFrequencyType": "DAY_INTERVAL",
        "readingDirection": "CONSUMPTION",
        "utility": "ELECTRICITY"
    },
    {
        "readingFrequencyType": "WEEK_INTERVAL",
        "readingDirection": "CONSUMPTION",
        "utility": "ELECTRICITY"
    },
    {
        "readingFrequencyType": "DAILY",
        "readingDirection": "CONSUMPTION",
        "utility": "ELECTRICITY"
    }
]
query property(
    $accountNumber: String!
    $activeFrom: DateTime
    $first: Int!
    $typedOnly: [TypedSourceInputType!]
    $startOn: Date
    $endOn: Date
    $startAt: DateTime
    $endAt: DateTime
    $timezone: String
) {
    account(accountNumber: $accountNumber) {
        properties(activeFrom: $activeFrom) {
            id
            measurements(
                first: $first
                typedOnly: $typedOnly
                startOn: $startOn
                endOn: $endOn
                startAt: $startAt
                endAt: $endAt
                timezone: $timezone
            ) {
                edges {
                    node {
                        source
                        value
                        unit
                        readAt
                        ... on IntervalMeasurementType {
                            startAt
                            endAt
                            accumulation
                            durationInSeconds
                            metaData{
                                statistics{
                                    type
                                    label
                                    description
                                    costExclTax {
                                        estimatedAmount
                                        costCurrency
                                    }
                                    costInclTax {
                                        estimatedAmount
                                        costCurrency
                                    }
                                    value
                                    __typename
                                }
                                typedSource{
                                    readingDirection
                                    readingFrequencyType
                                    sourceIdentifier
                                    utility
                                }
                            }
                        }
                    }
                }
                pageInfo {
                    hasNextPage
                    hasPreviousPage
                    startCursor
                    endCursor
                }
            }
        }
    }
}
# Input variables
{
    "accountNumber": "A-123456",
    "first": 10,
    "startAt": "2021-10-25T00:00:00-05:00",
    "endAt": "2021-10-30T00:00:00-05:00",
    "typedOnly": [
            {
                "readingFrequencyType": "FIFTEEN_MIN_INTERVAL",
                "readingDirection": "CONSUMPTION",
                "utility": "ELECTRICITY"
            }
        ]
}
import pprint

import requests

from datetime import datetime, timedelta

# API_URL = "https://api.oeus-kraken.energy/v1/graphql/" # prod
API_URL = "https://api.oeus-kraken.systems/v1/graphql/" # test
JWT_TOKEN = "PLACE_JWT_TOKEN_HERE"
HEADERS = {
    "Authorization": f"JWT {JWT_TOKEN}"
}

QUERY = """
    query property(
        $accountNumber: String!
        $activeFrom: DateTime
        $first: Int!
        $typedOnly: [TypedSourceInputType!]
        $startOn: Date
        $endOn: Date
        $startAt: DateTime
        $endAt: DateTime
        $timezone: String
    ) {
        account(accountNumber: $accountNumber) {
            properties(activeFrom: $activeFrom) {
                id
                measurements(
                    first: $first
                    typedOnly: $typedOnly
                    startOn: $startOn
                    endOn: $endOn
                    startAt: $startAt
                    endAt: $endAt
                    timezone: $timezone
                ) {
                    totalCount
                    edgeCount
                    edges {
                        node {
                            source
                            value
                            unit
                            readAt
                            ... on IntervalMeasurementType {
                                startAt
                                endAt
                                accumulation
                                durationInSeconds
                            }
                        }
                    }
                    pageInfo {
                        hasNextPage
                        hasPreviousPage
                        startCursor
                        endCursor
                    }
                }
            }
        }
    }
"""
start_at = datetime(2021, 10, 25)
end_at = start_at + timedelta(days=5)

# Recall we need a list
typed_only = [
    {
        "utility": "ELECTRICITY",
        "readingFrequencyType": "FIFTEEN_MIN_INTERVAL",
        "readingDirection": "CONSUMPTION",
    }
]


VARIABLES = {
    "accountNumber": "A-123456",
    "first": 10,
    "startAt": start_at.isoformat(),
    "endAt": end_at.isoformat(),
    "typedOnly": typed_only,
}


session = requests.Session()
session.headers.update(HEADERS)
response = session.post(
    url=API_URL,
    json={"query": QUERY, "variables": VARIABLES}
)
pprint.pprint(response.json())
const axios = require("axios")

// const apiUrl = "https://api.oeus-kraken.energy/v1/graphql/" // Prod
const apiUrl = "https://api.oeus-kraken.systems/v1/graphql/" // Test

const jwtToken = "PLACE_JWT_TOKEN_HERE"

let headers = {
  "Authorization": `JWT ${jwtToken}`
}

const query = `
        query property(
        $accountNumber: String!
        $activeFrom: DateTime
        $first: Int!
        $typedOnly: [TypedSourceInputType!]
        $startOn: Date
        $endOn: Date
        $startAt: DateTime
        $endAt: DateTime
        $timezone: String
    ) {
        account(accountNumber: $accountNumber) {
            properties(activeFrom: $activeFrom) {
                id
                measurements(
                    first: $first
                    typedOnly: $typedOnly
                    startOn: $startOn
                    endOn: $endOn
                    startAt: $startAt
                    endAt: $endAt
                    timezone: $timezone
                ) {
                    totalCount
                    edgeCount
                    edges {
                        node {
                            source
                            value
                            unit
                            readAt
                            ... on IntervalMeasurementType {
                                startAt
                                endAt
                                accumulation
                                durationInSeconds
                            }
                        }
                    }
                    pageInfo {
                        hasNextPage
                        hasPreviousPage
                        startCursor
                        endCursor
                    }
                }
            }
        }
    }
`

const startAt = new Date(2021, 10, 25);
const endAt = new Date(2021, 10, 30);

const typedOnly = [
    {
        "utility": "ELECTRICITY",
        "readingFrequencyType": "FIFTEEN_MIN_INTERVAL",
        "readingDirection": "CONSUMPTION",
    }
];

const variables = {
    "accountNumber": "A-123456",
    "first": 10,
    "startAt": startAt.toISOString(),
    "endAt": endAt.toISOString(),
    "typedOnly": typedOnly,
}

axios({
  url: apiUrl,
  method: "post",
  data: {
    query: query,
    variables: variables,
  },
  headers: headers,
}).then((response) => {
  console.log(JSON.stringify(response.data, null, 4));
});
import axios from 'axios';

// const API_URL = "https://api.oeus-kraken.energy/v1/graphql/" // Prod
export const apiUrl = "https://api.oeus-kraken.systems/v1/graphql/" // Test

export const jwtToken = "PLACE_JWT_TOKEN_HERE"

let headers = {"Authorization": `JWT ${jwtToken}`}

const query = `
    query property(
    $accountNumber: String!
    $activeFrom: DateTime
    $first: Int!
    $typedOnly: [TypedSourceInputType!]
    $startOn: Date
    $endOn: Date
    $startAt: DateTime
    $endAt: DateTime
    $timezone: String
) {
    account(accountNumber: $accountNumber) {
        properties(activeFrom: $activeFrom) {
            id
            measurements(
                first: $first
                typedOnly: $typedOnly
                startOn: $startOn
                endOn: $endOn
                startAt: $startAt
                endAt: $endAt
                timezone: $timezone
            ) {
                totalCount
                edgeCount
                edges {
                    node {
                        source
                        value
                        unit
                        readAt
                        ... on IntervalMeasurementType {
                            startAt
                            endAt
                            accumulation
                            durationInSeconds
                        }
                    }
                }
                pageInfo {
                    hasNextPage
                    hasPreviousPage
                    startCursor
                    endCursor
                    }
                }
            }
        }
    }
`;

enum UtilityType {
    ELECTRICITY = "ELECTRICITY",
}

// Type definitions
enum ReadingFrequencyType {
    FIFTEEN_MIN_INTERVAL = "FIFTEEN_MIN_INTERVAL",
    HOUR_INTERVAL = "HOUR_INTERVAL",
    DAY_INTERVAL = "DAY_INTERVAL",
    WEEK_INTERVAL = "WEEK_INTERVAL",
    MONTH_INTERVAL = "MONTH_INTERVAL",
    QUARTER_INTERVAL = "QUARTER_INTERVAL",
    DAILY = "DAILY",
}

enum ReadingDirection {
    CONSUMPTION = "CONSUMPTION",
    GENERATION = "GENERATION",
}

const typedOnly: {
    utility: UtilityType;
    readingFrequencyType: ReadingFrequencyType;
    readingDirection: ReadingDirection;
}[] = [
{
    utility: UtilityType.ELECTRICITY,
    readingFrequencyType: ReadingFrequencyType.FIFTEEN_MIN_INTERVAL,
    readingDirection: ReadingDirection.CONSUMPTION,
},
];

const startAt: Date = new Date(2021, 10, 25);
const endAt: Date = new Date(2021, 10, 30);

const variables = {
    "accountNumber": "A-123456",
    "first": 10,
    "startAt": startAt.toISOString(),
    "endAt": endAt.toISOString(),
    "typedOnly": typedOnly,
};
axios({
  url: apiUrl,
  method: "post",
  data: {
    query: query,
    variables: variables,
  },
  headers: headers,
}).then((response) => {
  console.log(JSON.stringify(response.data, null, 4));
});
{
    "data": {
        "account": {
            "properties": [
                {
                    "id": "9065",
                    "measurements": {
                        "edges": [
                            {
                                "node": {
                                    "source": "meter_point.electricity.interval.meter_point.esi_id.1008900000000000000108.consumption",
                                    "value": "0.06200",
                                    "unit": "kWh",
                                    "readAt": "2021-10-25T05:15:00+00:00",
                                    "startAt": "2021-10-25T05:00:00+00:00",
                                    "endAt": "2021-10-25T05:15:00+00:00",
                                    "accumulation": null,
                                    "durationInSeconds": 900,
                                    "metaData": {
                                        "typedSource": {
                                            "readingDirection": "CONSUMPTION",
                                            "readingFrequencyType": "FIFTEEN_MIN_INTERVAL",
                                            "sourceIdentifier": "meter_point.esi_id.1008900000000000000108",
                                            "utility": "ELECTRICITY"
                                        }
                                    }
                                }
                            },
                            {
                                "node": {
                                    "source": "meter_point.electricity.interval.meter_point.esi_id.1008900000000000000108.consumption",
                                    "value": "0.06200",
                                    "unit": "kWh",
                                    "readAt": "2021-10-25T05:15:00+00:00",
                                    "startAt": "2021-10-25T05:00:00+00:00",
                                    "endAt": "2021-10-25T05:15:00+00:00",
                                    "accumulation": null,
                                    "durationInSeconds": 900,
                                    "metaData": {
                                        "typedSource": {
                                            "readingDirection": "CONSUMPTION",
                                            "readingFrequencyType": "FIFTEEN_MIN_INTERVAL",
                                            "sourceIdentifier": "meter_point.esi_id.1008900000000000000108",
                                            "utility": "ELECTRICITY"
                                        }
                                    }
                                }
                            },
                            {
                                "node": {
                                    "source": "meter_point.electricity.interval.meter_point.esi_id.1008900000000000000108.consumption",
                                    "value": "0.32600",
                                    "unit": "kWh",
                                    "readAt": "2021-10-25T05:30:00+00:00",
                                    "startAt": "2021-10-25T05:15:00+00:00",
                                    "endAt": "2021-10-25T05:30:00+00:00",
                                    "accumulation": null,
                                    "durationInSeconds": 900,
                                    "metaData": {
                                        "typedSource": {
                                            "readingDirection": "CONSUMPTION",
                                            "readingFrequencyType": "FIFTEEN_MIN_INTERVAL",
                                            "sourceIdentifier": "meter_point.esi_id.1008900000000000000108",
                                            "utility": "ELECTRICITY"
                                        }
                                    }
                                }
                            },
                            {
                                "node": {
                                    "source": "meter_point.electricity.interval.meter_point.esi_id.1008900000000000000108.consumption",
                                    "value": "0.32600",
                                    "unit": "kWh",
                                    "readAt": "2021-10-25T05:30:00+00:00",
                                    "startAt": "2021-10-25T05:15:00+00:00",
                                    "endAt": "2021-10-25T05:30:00+00:00",
                                    "accumulation": null,
                                    "durationInSeconds": 900,
                                    "metaData": {
                                        "typedSource": {
                                            "readingDirection": "CONSUMPTION",
                                            "readingFrequencyType": "FIFTEEN_MIN_INTERVAL",
                                            "sourceIdentifier": "meter_point.esi_id.1008900000000000000108",
                                            "utility": "ELECTRICITY"
                                        }
                                    }
                                }
                            },
                            {
                                "node": {
                                    "source": "meter_point.electricity.interval.meter_point.esi_id.1008900000000000000108.consumption",
                                    "value": "0.04800",
                                    "unit": "kWh",
                                    "readAt": "2021-10-25T05:45:00+00:00",
                                    "startAt": "2021-10-25T05:30:00+00:00",
                                    "endAt": "2021-10-25T05:45:00+00:00",
                                    "accumulation": null,
                                    "durationInSeconds": 900,
                                    "metaData": {
                                        "typedSource": {
                                            "readingDirection": "CONSUMPTION",
                                            "readingFrequencyType": "FIFTEEN_MIN_INTERVAL",
                                            "sourceIdentifier": "meter_point.esi_id.1008900000000000000108",
                                            "utility": "ELECTRICITY"
                                        }
                                    }
                                }
                            },
                            {
                                "node": {
                                    "source": "meter_point.electricity.interval.meter_point.esi_id.1008900000000000000108.consumption",
                                    "value": "0.04800",
                                    "unit": "kWh",
                                    "readAt": "2021-10-25T05:45:00+00:00",
                                    "startAt": "2021-10-25T05:30:00+00:00",
                                    "endAt": "2021-10-25T05:45:00+00:00",
                                    "accumulation": null,
                                    "durationInSeconds": 900,
                                    "metaData": {
                                        "typedSource": {
                                            "readingDirection": "CONSUMPTION",
                                            "readingFrequencyType": "FIFTEEN_MIN_INTERVAL",
                                            "sourceIdentifier": "meter_point.esi_id.1008900000000000000108",
                                            "utility": "ELECTRICITY"
                                        }
                                    }
                                }
                            },
                            {
                                "node": {
                                    "source": "meter_point.electricity.interval.meter_point.esi_id.1008900000000000000108.consumption",
                                    "value": "0.05600",
                                    "unit": "kWh",
                                    "readAt": "2021-10-25T06:00:00+00:00",
                                    "startAt": "2021-10-25T05:45:00+00:00",
                                    "endAt": "2021-10-25T06:00:00+00:00",
                                    "accumulation": null,
                                    "durationInSeconds": 900,
                                    "metaData": {
                                        "typedSource": {
                                            "readingDirection": "CONSUMPTION",
                                            "readingFrequencyType": "FIFTEEN_MIN_INTERVAL",
                                            "sourceIdentifier": "meter_point.esi_id.1008900000000000000108",
                                            "utility": "ELECTRICITY"
                                        }
                                    }
                                }
                            },
                            {
                                "node": {
                                    "source": "meter_point.electricity.interval.meter_point.esi_id.1008900000000000000108.consumption",
                                    "value": "0.05600",
                                    "unit": "kWh",
                                    "readAt": "2021-10-25T06:00:00+00:00",
                                    "startAt": "2021-10-25T05:45:00+00:00",
                                    "endAt": "2021-10-25T06:00:00+00:00",
                                    "accumulation": null,
                                    "durationInSeconds": 900,
                                    "metaData": {
                                        "typedSource": {
                                            "readingDirection": "CONSUMPTION",
                                            "readingFrequencyType": "FIFTEEN_MIN_INTERVAL",
                                            "sourceIdentifier": "meter_point.esi_id.1008900000000000000108",
                                            "utility": "ELECTRICITY"
                                        }
                                    }
                                }
                            },
                            {
                                "node": {
                                    "source": "meter_point.electricity.interval.meter_point.esi_id.1008900000000000000108.consumption",
                                    "value": "0.55500",
                                    "unit": "kWh",
                                    "readAt": "2021-10-25T06:15:00+00:00",
                                    "startAt": "2021-10-25T06:00:00+00:00",
                                    "endAt": "2021-10-25T06:15:00+00:00",
                                    "accumulation": null,
                                    "durationInSeconds": 900,
                                    "metaData": {
                                        "typedSource": {
                                            "readingDirection": "CONSUMPTION",
                                            "readingFrequencyType": "FIFTEEN_MIN_INTERVAL",
                                            "sourceIdentifier": "meter_point.esi_id.1008900000000000000108",
                                            "utility": "ELECTRICITY"
                                        }
                                    }
                                }
                            },
                            {
                                "node": {
                                    "source": "meter_point.electricity.interval.meter_point.esi_id.1008900000000000000108.consumption",
                                    "value": "0.55500",
                                    "unit": "kWh",
                                    "readAt": "2021-10-25T06:15:00+00:00",
                                    "startAt": "2021-10-25T06:00:00+00:00",
                                    "endAt": "2021-10-25T06:15:00+00:00",
                                    "accumulation": null,
                                    "durationInSeconds": 900,
                                    "metaData": {
                                        "typedSource": {
                                            "readingDirection": "CONSUMPTION",
                                            "readingFrequencyType": "FIFTEEN_MIN_INTERVAL",
                                            "sourceIdentifier": "meter_point.esi_id.1008900000000000000108",
                                            "utility": "ELECTRICITY"
                                        }
                                    }
                                }
                            }
                        ],
                        "pageInfo": {
                            "hasNextPage": true,
                            "hasPreviousPage": false,
                            "startCursor": "YXJyYXljb2AAAAA0aW9uOjA=",
                            "endCursor": "YXJyYXljb25uZBBBBBW9uOjk="
                        }
                    }
                }
            ]
        }
    }
}
Back to top