NAV
python

Introduction

Electric vehicle charge point siting optimisation using a protoype webGIS interface and a database of granular datasets. A collaborative project between Advanced Infrastructure Technologies Limited & EB Charging.

Important Links

Authentication

All APIs are secure with an API key. Please contact the developer for an API key. If you have recieved an API key add the following headers to your request

Nothing to see here - scroll down for documentation usage.

Authorization: YOURAPIKEY

EVCP

Download Datasets

import requests

params = {
  'user_id' : 'user_hash'
}
api = requests.get(url,params=params)

The above command returns JSON structured like this:

{
    "data": {
        "2748a2d9-f859-4576-91cf-dfe89ff97376": {
            "config": {},
            "filters": [],
            "metadata": {
                "filename": "dataset filename"
            }
        },
    "message": "Success"
}

On Signup, this API will fetches the dataset ids, names and configs from the database.

HTTP Request

GET https://w37wxygruf.execute-api.eu-central-1.amazonaws.com/prod/staticdataset/

Query Parameters

Parameter Description
user_id user id provided after signup

Download a specific dataset

import requests

params  = {
  'dataset_id' : 'dataset_hash'
}
api = requests.get(url,params=params)

The above command returns JSON structured like this:

{
  "data": {'file_url': S3_URL},
  "message": "Success"
}

This endpoint retrieves the presigned s3 link for the dataset id

HTTP Request

GET https://8fqz5r5ul3.execute-api.eu-central-1.amazonaws.com/prod/dataset

Query Parameters

Parameter Description
dataset_id UUID of the file. All static datasets are assigned a uuid4() hash.

Restore configuration

import requests

params  = {
  'user_id' : 'user_id',
  'dataset_id' : 'dataset_hash',
  'overwrite' : True
}
api = requests.post(url,params=params)

The above command returns JSON structured like this:

{
   "data": {},
   "message": "Success"
}

Restore configuration for a dataset by fetching the original configuration supplied by AI

HTTP Request

POST https://w37wxygruf.execute-api.eu-central-1.amazonaws.com/prod/resetconfig

URL Parameters

Parameter Description
user_id The ID of the user
dataset_id Hash of the dataset
overwrite True or False

Update Metadata

import requests

params  = {
  'user_id' : 'user_id',
  'dataset_id' : 'dataset_hash',
  'meta': {'config': {}, 'metadata': {},'filters': {}}
}
api = requests.post(url,params=params)
{
  "user_id": "user_id",
  "dataset_id": "dataset_hash",
  "meta": {"filters": {}}
}

The above command returns JSON structured like this:

{
   "data": {},
   "message": "Success"
}

This will update the “dataset” collection in firebase with document as “user_id”. Inside the document we will have a object with key as “file_hash” and value as passed in “meta”.

HTTP Request

POST https://w37wxygruf.execute-api.eu-central-1.amazonaws.com/prod/updatemeta

URL Parameters

Parameter Description
user_id The ID of the user
dataset_id Hash of the dataset
meta Object

Meta object json { "config": {}, "metadata": {}, "filters": {} }

Errors

The EVCP API uses the following error codes:

Error Code Meaning
400 Bad Request -- Your request is invalid.
401 Unauthorized -- Your API key is wrong.
403 Forbidden -- The data requested is hidden for administrators only.
404 Not Found -- The dataset content could not be found.
405 Method Not Allowed -- You tried to access a dataset with an invalid method.
406 Not Acceptable -- You requested a format that isn't json.
429 Too Many Requests -- You're requesting too many datasets! Slow down!
500 Internal Server Error -- We had a problem with our server. Try again later.
503 Service Unavailable -- We're temporarily offline for maintenance. Please try again later.