import requests
from requests.auth import HTTPBasicAuth
from urllib.parse import urlencode
import pandas as pd
import matplotlib.pyplot as plt
# set host, like http://localhost:8000, to where your Data Hub is running
HOST = ''
# in case of basic auth set to HTTPBasicAuth('user', 'password')
AUTH = None
q = {
'datalayer_key': 'copernicus_water',
# Optional filters to narrow down the returned data:
#'shape_id': '',
#'shape_type': '',
#'start_date': '',
#'end_date': '',
}
d = requests.get(f"{HOST}/api/datalayers/data/?{urlencode(q)}", auth=AUTH).json()
copernicus_water_df = pd.DataFrame(d['data'])
copernicus_water_df['year'] = pd.to_datetime(copernicus_water_df['year'], format="%Y")
There is no ready use snippet for API usage in R yet, though you can adapt the Python example to your R needs.