Index
OEKG web based access#
In this document we describe how you can access the contents of the OEKG via Web based Requests using HTTP
The SPARQL endpoint for OEKG#
https://openenergyplatform.org/api/v0/oekg/sparql/
Here is an example of how to query the Open Energy Knowledge Graph (OEKG) using SPARQL using python and the requests library for http requests.
OEP-API Token
For authentication with the OEP-REST-API you have to register on https://openenergyplatform.org/accounts/signup/ or sign in with you institution. Once you are registered you can find your API Token in you Profile page under the "Settings" Tab. Clicks "Show Token" and copy the hash value.
See our more detailed guide on how to get started with the OpenEnergyPlatform.
import requests
OEP_API_TOKEN = "<Add-Your-Token>"
HEADER = {"Authorization": f"Token {OEP_API_TOKEN}"}
sparql_endpoint = "https://openenergyplatform.org/api/v0/oekg/sparql/"
payload = {
"query": """SELECT ?s ?p ?o
WHERE {
?s ?p ?o
}""",
"format": "json"
}
r = requests.post(url=sparql_endpoint, json=payload, headers=HEADER)
print(r.json())
Open API#
Below you see a draft version of the OpenAPI-based. It is the documentation for all HTTP-API endpoints and in the future it can be used to test out the API.