Skip to content

Instantly share code, notes, and snippets.

@chris-french
Last active August 4, 2020 02:50
Show Gist options
  • Save chris-french/526ee6b2b458ff61dd620bdee2a9e594 to your computer and use it in GitHub Desktop.
Save chris-french/526ee6b2b458ff61dd620bdee2a9e594 to your computer and use it in GitHub Desktop.

Meep APIs

Resources

Location

Property Description
id Int
address String
city String
latitude Double
longitude Double
state String
zipCode Int

Project

Property Description
id Int
name String
description String
photo_url String
website_url String
year Int
gge_reduced Double
ghg_reduced Double
project_type_id Int

Operations

Operation: Get Location Markers

URL: /location-markers

Example: GET http://127.0.0.1:5000/location-markers

{
    "locationMarkers":[
        {
            "center":{
                "lat":-95.2632409,
                "lng":38.9930314
            },
            "gge_reduced":1995.0,
            "ghg_reduced":2.5845225,
            "points":[
                {
                    "lat":-95.2632409,
                    "lng":38.9930314
                }
            ],
            "project_ids":[1],
            "project_name":"Black Hills Energy- KS",
            "project_types":["Building"]
        },
        {
            "center":{
                "lat":-94.6095686,
                "lng":38.8705357
            },
            "gge_reduced":2891.461077,
            "ghg_reduced":1.133452742,
            "points":[
                {
                    "lat":-94.6095686,
                    "lng":38.8705357
                }
            ],
            "project_ids":[2],
            "project_name":"Central States Beverage Company",
            "project_types":["Building"]
        }
    ]
}

Operation: Get Location by ID

URL: /locations/<int:id>

Example: GET http://127.0.0.1:5000/locations/1

{
    "address":"601 N Iowa St",
    "city":"Lawrence",
    "latitude":-95.2632409,
    "longitude":38.9930314,
    "state":"KS",
    "zipCode":66044
}

Operation: Get Locations

Returns a list of all locations.

URL: /locations

EXAMPLE: GET http://127.0.0.1:5000/locations/

{
    "locations":[
        {
            "address":"601 N Iowa St",
            "city":"Lawrence",
            "id":1,
            "latitude":-95.2632409,
            "longitude":38.9930314,
            "state":"KS",
            "zipCode":66044
        },
        {
            "address":"14220 Wyandotte St",
            "city":"Kansas City",
            "id":2,
            "latitude":-94.6095686,
            "longitude":38.8705357,
            "state":"MO",
            "zipCode":64145
        }
    ]
}

Operation: GET Project by Location ID

URL: /locations/<int:id>/project

Example: GET http://127.0.0.1:5000/locations/1/project

{
    "id": 1, 
    "name": "Black Hills Energy- KS", 
    "description": null, 
    "photo_url": null, 
    "website_url": null, 
    "year": 2013, 
    "gge_reduced": 1995.0, 
    "ghg_reduced": 2.5845225, 
    "project_type_id": 1
}

Operation: GET Projects

URL: /projects

Example: GET http://127.0.0.1:5000/projects

{
    "projects": [
        {
            "id": 1, 
            "name": "Black Hills Energy- KS", 
            "description": null, 
            "photoUrl": null, 
            "websiteUrl": null, 
            "year": 2013, 
            "ggeReduced": 1995.0, 
            "ghgReduced": 2.5845225
        },
        {
            "id": 2, 
            "name": "Central States Beverage Company", 
            "description": null, 
            "photoUrl": null, 
            "websiteUrl": null, 
            "year": 2012, 
            "ggeReduced": 2891.461077, 
            "ghgReduced": 1.133452742
        }
    ]
}

Operation: GET Project by ID

URL: /projects/<int:id>

Example: GET http://127.0.0.1:5000/projects/1

{   
    "id": 1, 
    "name": "Black Hills Energy- KS", 
    "description": null, 
    "photoUrl": null, 
    "websiteUrl": null, 
    "year": 2013, 
    "ggeReduced": 1995.0, 
    "ghgReduced": 2.5845225
}

Operation: GET Project Types

URL: /project-types

Example: GET http://127.0.0.1:5000/project-types

{
    "project_types": [
        {
            "id": 1, 
            "typeName": "Building"
        }, 
        {
            "id": 2, 
            "typeName": "Vehicle Transportation"
        }, 
        {
            "id": 3, 
            "typeName": "Infastructure Transportation"
        }
    ]
}

Operation: Get Project Type by ID

URL: /project-types/<int:id>

Example: GET http://127.0.0.1:5000/project-types/1

{
    "id": 1, 
    "typeName": "Building"
}

Operation: GET Projects by Project Type

URL: /project-type/<ind:id>/project

Example: GET http://127.0.0.1:5000/project-types/1/projects

{
    "projects": [
        {
            "id": 1, 
            "name": "Black Hills Energy- KS", 
            "description": null, 
            "photo_url": null, 
            "website_url": null, 
            "year": 2013, 
            "gge_reduced": 1995.0, 
            "ghg_reduced": 2.5845225, 
            "project_type_id": 1
        },
        {
            "id": 2, 
            "name": "Central States Beverage Company", 
            "description": null, 
            "photo_url": null, 
            "website_url": null, 
            "year": 2012, 
            "gge_reduced": 2891.461077, 
            "ghg_reduced": 1.133452742, 
            "project_type_id": 1
        },
        {
            "id": 6, 
            "name": "Lincoln Airport Authority -CNG", 
            "description": null, 
            "photo_url": null, 
            "website_url": null, 
            "year": 2017, 
            "gge_reduced": 11970.0, 
            "ghg_reduced": 15.507135, 
            "project_type_id": 1
        },
        {
            "id": 7, 
            "name": " State of Missouri - Propane", 
            "description": null, 
            "photo_url": null, 
            "website_url": null, 
            "year": 2017, 
            "gge_reduced": 903.101, 
            "ghg_reduced": 1.276533264, 
            "project_type_id": 1
        }
    ]
}

Operation: GET All Locations by Project ID

URL: /projects/<int:id>/locations

Example: GET http://127.0.0.1:5000/projects/1/locations

{
    "locations": [
        {
            "address": "601 N Iowa St",
            "city": "Lawrence",
            "state": "KS",
            "zip_code": 66044,
            "longitude": 38.9930314,
            "latitude": -95.2632409
        }
    ]
}

Operation: GET Project Detail by Project ID

URL: /projects/1/detail

Example: GET http://127.0.0.1:5000/projects/1/detail

{
    "date":"2013",
    "details":null,
    "emissions_data":{
        "gge_reduced":1995.0,
        "ghg_reduced":2.5845225
    },
    "img":null,
    "project_name":"Black Hills Energy- KS",
    "project_type":"Building"
}

Operation: GET Project Summary by Project ID

URL: /projects/<int:id>/summary

Example: GET http://127.0.0.1:5000/projects/1/summary

{
    "date":"2013",
    "img":null,
    "project_details":null,
    "project_name":"Black Hills Energy- KS"
}

Operation: POST Project New from CSV

URL: /projects/upload/csv

Example: POST 127.0.0.1:5000/projects/upload/csv

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment