RDCEP / energy-maps-api

An API for RDCEP's US Energy Infrastructure Visualization
0 stars 0 forks source link

Schedule of API Endpoints #1

Open bkleeman opened 2 years ago

bkleeman commented 2 years ago

Schedule of API Endpoints

Our API needs a uniform interface for client requests, so we must determine the best way to format our URIs.

Considerations

URL Prefix:

/api/<version_number>/infrastructure

Should we lead with primary type or secondary type?

How do we want to handle issues with pluralization?

Example of a problem with endpoints following the format:/infrastructure/primary_type/secondary_type

Pseudocode for an endpoint in the /retrieve dir

Please forgive the mixing python/js. Secondary type is null, so

bp = Blueprint('create', name, url_prefix=URL_PREFIX)

def get_infrastructure():
    if (properties.type.secondary is not None) { 
        url = '/{properties.type.primary}/${properties.type.secondary}'
    } else {
        url = '/{properties.type.primary}' 
    }
    return url


### Examples of tentative endpoints
`/mines` i.e. return all mines
`/mines/coal`
`/underground_storage`
`/underground_storage/gas`
`/pipelines` i.e. show all pipelines
`/pipelines/gas`
bkleeman commented 2 years ago

List of API Endpoints if we follow the type.primary, type.secondary convention, in plural form

There are things about some of these that seem funky, and I would definitely love feedback on what I have here. We will need to go into the db and update primary types to be plural, and we may need to do more from there as well. I anticipate that more work needs to be done before we can start actually creating our endpoints.

bkleeman commented 2 years ago

Endpoints we may need where data is not currently in the database

bkleeman commented 2 years ago

Some Resolutions, 08/26:

bkleeman commented 2 years ago

MongoDB Updates

I went through and made updates to all relevant docs in mongodb to pluralize them.

Completed:

No action needed