Skip to content

Repository files navigation

EarthRef's Framework for Integrated Earth Science and Technology Applications (FIESTA) API

Usage

The deployed API is currently available at https://api.earthref.org/v1 with documentation at https://api.earthref.org. These GET requests can be made in the browser to test the API:

Get the metadata for the latest 10 MagIC contributions as JSON rows:

Get the metadata for the latest 20 locations in MagIC that mention "sedimentary" as JSON rows:

Get MagIC contribution 16645 in MagIC Text File format:

These requests can also be made with an HTTP request client, for example getting a contribution with Python:

importrequests# Get the 50 latest sites in MagICresponse=requests.get(
'https://api.earthref.org/v1/MagIC/contribution/16663',
headers={'Accept': 'text/plain'}
)
# Check the response status codeif (response.status_code==404):
print('Request URL is incorrect.')
if (response.status_code==204):
print('Contribution ID doesn''t exist.')
# Parse the first 100 characters of the contributionprint(response.content[0:100])

Or searching with Python:

importrequestsimportpandas# Get the 50 latest sites in MagICresponse=requests.get(
'https://api.earthref.org/v1/MagIC/search/sites',
params={'query': 'devonian', 'size': 50},
headers={'Accept': 'application/json'}
)
# Check the response status codeif (response.status_code==404):
print('Request URL is incorrect.')
# Parse the JSON output into a dictionaryjson_response=response.json()
# Retrieve the list of sites, of which each site may have multiple data rowssites=json_response['results']
# Flatten the sites rowsdefflatten(listOflists):
return [itemforsublistinlistOflistsforiteminsublist]
sites_rows=flatten(sites)
sites_df=pandas.DataFrame(sites_rows)
sites_df.head()

Development

npm install
npm dev
# API running at http://localhost:3100

About

EarthRef's FIESTA API

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages