API documentation


Initialization

First, we set some variables.

export GRID_API_HOST="http://localhost:9980"
export GRID_API_KEY="1|testKeyForDevelopmentOnly"
alias api_curl="curl --no-progress-meter \
    -H 'accept: application/json' \
    -H 'Authorization: Bearer ${GRID_API_KEY}' \
    -H 'Content-Type: application/json'"

Creating objects

Create an Organisation

api_curl
    -X 'POST' "${GRID_API_HOST}/api/organisations" \
    -d '{"name":"test"}'

Create a Location

api_curl
    -X 'POST' "${GRID_API_HOST}/api/organisations/2/locations" \
    -d '{"name":"test", "latitude":0, "longitude":0}'

Create a Device

api_curl
    -X 'POST' "${GRID_API_HOST}/api/locations/1/devices" \
    -d '{"name":"test device", "device_type_id":1, "external_device_identifier":"1234567890abcdef", "configuration":[]}'

Retrieving objects

Device types

Get all device types

api_curl -X 'GET' "${GRID_API_HOST}/api/device-types"

Get all details of one device type

api_curl -X 'GET' "${GRID_API_HOST}/api/device-types/1"

Organisations

Get all organisations

api_curl -X 'GET' "${GRID_API_HOST}/api/organisations"

Get all details of one organisation

api_curl -X 'GET' "${GRID_API_HOST}/api/organisations/2"

Get all locations of one organisation

api_curl -X 'GET' "${GRID_API_HOST}/api/organisations/2/locations"

Locations

Get all details of one location

api_curl -X 'GET' "${GRID_API_HOST}/api/locations/1"

Devices

Get all devices of a location

api_curl -X 'GET' "${GRID_API_HOST}/api/locations/1/devices"

Get all details of one device

api_curl -X 'GET' "${GRID_API_HOST}/api/devices/1"

Counters

Get all counters of a device

api_curl -X 'GET' "${GRID_API_HOST}/api/devices/1/counters"

Get all details of one counter

api_curl -X 'GET' "${GRID_API_HOST}/api/counters/1"

Data

Counters

Get latest counter data

api_curl -X 'GET' "${GRID_API_HOST}/api/counters/1/latest"

Get the latest data for all counters of a device

api_curl -X 'GET' "${GRID_API_HOST}/api/devices/1/latest"

Get the latest data for all devices in a location

api_curl -X 'GET' "${GRID_API_HOST}/api/locations/1/latest"

Get the latest data for all locations in an organisation

api_curl -X 'GET' "${GRID_API_HOST}/api/organisations/2/latest"

Get counter-data for a given period

api_curl -X 'GET' "${GRID_API_HOST}/api/counters/1/data?startDateTime=YYYY-MM-DD&endDateTime=YYYY-MM-DD"

Get hourly counter-values

api_curl -X 'GET' "${GRID_API_HOST}/api/counters/1/hourly"

Get hourly device values

api_curl -X 'GET' "${GRID_API_HOST}/api/devices/1/hourly"
api_curl -X 'GET' "${GRID_API_HOST}/api/devices/1/hourly/solar"

Get hourly data for all devices in a location

api_curl -X 'GET' "${GRID_API_HOST}/api/locations/1/hourly"

Get hourly solar data for all devices in a location

api_curl -X 'GET' "${GRID_API_HOST}/api/locations/1/hourly/solar"

Get hourly data for all locations in an organisation

api_curl -X 'GET' "${GRID_API_HOST}/api/organisations/2/hourly"

Get hourly solar data for all locations in an organisation

api_curl -X 'GET' "${GRID_API_HOST}/api/organisations/2/hourly/solar"

Get counter-totals

api_curl -X 'GET' "${GRID_API_HOST}/api/counters/1/total"

Get device totals

api_curl -X 'GET' "${GRID_API_HOST}/api/devices/1/total"
api_curl -X 'GET' "${GRID_API_HOST}/api/devices/1/total/solar"

Get location totals

api_curl -X 'GET' "${GRID_API_HOST}/api/locations/1/total"
api_curl -X 'GET' "${GRID_API_HOST}/api/locations/1/total/solar"

Get organisation totals

api_curl -X 'GET' "${GRID_API_HOST}/api/organisations/2/total"
api_curl -X 'GET' "${GRID_API_HOST}/api/organisations/2/total/solar"

Weather data

Get current weather

api_curl -X 'GET' "${GRID_API_HOST}/api/weather/1/now"

Get the weather forecast for today

api_curl -X 'GET' "${GRID_API_HOST}/api/weather/1/today"

Get the weather forecast for tomorrow

api_curl -X 'GET' "${GRID_API_HOST}/api/weather/1/tomorrow"

Energy price data

Get current energy prices

api_curl -X 'GET' "${GRID_API_HOST}/api/energy-prices/1/now"

Get energy price totals

api_curl -X 'GET' "${GRID_API_HOST}/api/energy-prices/1/total"

Get hourly energy prices

api_curl -X 'GET' "${GRID_API_HOST}/api/energy-prices/1/hourly"

Solar forecast data

Get solar forecast for today

api_curl -X 'GET' "${GRID_API_HOST}/api/solar-forecast/1"