<jupyter_start><jupyter_text>CORIOLIX REST API Documentation EXAMPLE 1: Query the CORIOLIX REST API - Get a list of all REST endpoints<jupyter_code>"""Example script to query the CORIOLIX REST API."""

# Key concepts:
# Use the python requests module to query the REST API
# Use the python json module to parse and dump the json response

# Returns:
# Returns a list of all CORIOLIX REST Endpoints

import requests
import json

# Base URL for Datapresence REST API - MODIFY AS NEEDED
rest_url = 'https://coriolix.ceoas.oregonstate.edu/oceanus/api/?format=json'

# Make the query to the REST API
response = requests.get(rest_url, verify=False)

# Load the response as json data
responseJSON = json.loads(response.text)

# Print all the published endpoints
print(json.dumps(responseJSON, indent=4, sort_keys=True))<jupyter_output>{
    "anemo_mmast": "https://coriolix.ceoas.oregonstate.edu/oceanus/api/anemo_mmast/?format=json",
    "asset": "https://coriolix.ceoas.oregonstate.edu/oceanus/api/asset/?format=json",
    "cur_obs": "https://coriolix.ceoas.oregonstate.edu/oceanus/api/cur_obs/?format=json",
    "cur_obs_archive": "https://coriolix.ceoas.oregonstate.edu/oceanus/api/cur_obs_archive/?format=json",
    "custom_sensor_1": "https://coriolix.ceoas.oregonstate.edu/oceanus/api/custom_sensor_1/?format=json",
    "custom_sensor_2": "https://coriolix.ceoas.oregonstate.edu/oceanus/api/custom_sensor_2/?format=json",
    "custom_sensor_3": "https://coriolix.ceoas.oregonstate.edu/oceanus/api/custom_sensor_3/?format=json",
    "echo_well": "https://coriolix.ceoas.oregonstate.edu/oceanus/api/echo_well/?format=json",
    "events": "https://coriolix.ceoas.oregonstate.edu/oceanus/api/events/?format=json",
    "fluor_flth": "https://coriolix.ceoas.oregonstate.edu/oceanus/api/fluor_flth/?format=json",
    "gnss_gga_bow": "h[...]<jupyter_text>EXAMPLE 2: Query the CORIOLIX REST API - Get the current sensor observation<jupyter_code>"""Example script to query the CORIOLIX REST API."""

# Key concepts:
# Use the python requests module to query the REST API
# Use the python json module to parse and dump the json response
# Select a specific endpoint to query.

# Returns:
# Returns a list of all currently valid sensor values

import requests
import json

# URL for Datapresence REST endpoint for the current observations table.
rest_url = 'https://coriolix.ceoas.oregonstate.edu/oceanus/api/cur_obs/?format=json'
#rest_url = 'https://coriolix.ceoas.oregonstate.edu/oceanus/api/decimateData/?model=TsgFlth&date_0=2019-10-10%2002:06:55.353%2B00&decfactr=1&format=json'

# Make the query to the REST API
response = requests.get(rest_url, verify=False)

# Load the response as json data
responseJSON = json.loads(response.text)

# Print all current observations
print(json.dumps(responseJSON, indent=4, sort_keys=True))
## EXAMPLE 3: Query the CORIOLIX REST API - Get the Thermosalinograph data for a user specified window of time
"""Example script to query the CORIOLIX REST API."""

# Key concepts:
# Use the python requests module to query the REST API
# Use the python json module to parse and dump the json response
# Select a specific sensor endpoint to query.
# Filter results

# Returns:
# Returns a list of all currently valid sensor values

import requests
import json

# URL for Datapresence REST endpoint for the current thermosalinograph table.
base_url = 'https://coriolix.ceoas.oregonstate.edu/oceanus/api/decimateData/?model=TsgFlth'

# Set the start date and time using the ISO8601 format, data stored in UTC
start_date = '2019-10-08T20:00:00Z'
end_date = '2019-10-08T21:00:00Z'

# build the query string
query_url = base_url+'?date_0='+start_date+'&date_1='+end_date+'&format=json'
query_url = base_url+'&date_0=2019-10-10%2002:06:55.353%2B00&decfactr=1&format=json'

# Make the query to the REST API
response = requests.get(query_url, verify=False)

# Load the response as json data
responseJSON = json.loads(response.text)

# Print all thermosalinograph observations
print(json.dumps(responseJSON, indent=4, sort_keys=True))<jupyter_output>/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/urllib3/connectionpool.py:858: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
  InsecureRequestWarning)
{'fraction_non_alphanumeric': 0.11224954462659381, 'fraction_numerical': 0.023451730418943533, 'mean_word_length': 5.441348973607038, 'pattern_counts': {'":': 11, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 15, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '13660', 'license': 'MIT', 'n_tokens_mistral': 1588, 'n_tokens_neox': 1477, 'n_words': 374, 'path': 'CORIOLIX_REST_API_Quickstart.ipynb', 'repo_name': 'cromsos/CORIOLIX_jupyter', 'size': '4392'}