Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents

Step 1:

As of January 2020 GLTG has 32,122,836 datapoints. Please don't fetch all of them at once.

The best way to get datapoints by sensor id in the example below.

Create an Account 

Jupyter Notebook

geostreams_jupyter.ipynb

Examples using Curl

...

    • You're done

Step 2: Acquire Data from API by using CURL

You can acquire the data from API by using curl command

Get all Sensors in JSON format

Currently, pulling sensors does not require authentication.

InputsOutput typeOutput Example
url

JSON


Code Block
languagejs
titleOutput JSON example
collapsetrue
{ "sensors":[

         { "id":1445,
         "name":"03254520",
         "created":"2018-03-23T15:48:32Z",
         "geoType":"Feature",
         "geometry":{ "type":"Point", "coordinates":[ -84.44799549,38.9203417,0]
         },
         "properties":{ "name":"03254520",
                        "huc":{ "huc8":{ "code":"05100101"},"huc2":{"code":"05" },
                                "huc4":{"code":"0510"}, "huc6":{"code":"051001"},
                                "huc_name":"Licking"
                              },
           "region":"0510",
           "location":"LICKING RIVER AT HWY 536 NEAR ALEXANDRIA, KY",
           "type":{ 
               "title":"United States Geological Survey",
               "network":"NWIS",
               "id":"usgs"
            },
            "popupContent":"03254520",
            "online_status":"online",
            "id":1445
         },
         "min_start_time":"2007-10-01T06:00:00Z",
         "max_end_time":"2020-02-05T12:30:00Z",
         "parameters":[ 
            "discharge-ft3s",
            "discharge-ft3s-qc",
            "dissolved-oxygen-mgl",
            "dissolved-oxygen-mgl-qc",
            "nitrate-nitrite-as-n-mgl",
            "nitrate-nitrite-as-n-mgl-qc",
            "pH",
            "pH-qc",
            "specific-conductance-uScm",
            "specific-conductance-uScm-qc",
            "turbidity-fnu",
            "turbidity-fnu-qc",
            "water-temperature-c",
            "water-temperature-c-qc"
            ],
            ....
    ]
}}



Code Block
titleGet all Sensors
curl -X GET --compressed 

...

https://greatlakestogulf.org/geostreams/api/sensors

...

Authenticate

InputsOutputDetails
  • url
  • email
  • password
X-Auth-TokenUse the token for fetching datapoints


Code Block
titleAuthenticate
curl -X POST -H 'Content-Type: application/json' -d 

...

'{"password": "****", "identifier": "email"}' --compressed -i https://greatlakestogulf.org/geostreams/api/authenticate

...

  • password
  • email

...

Get all Datapoints for Single Sensor

We request that a user not try to pull all datapoints concurrently.  It is preferred that datapoints be pulled in series by sensor id.

InputsOutput TypeDetailsExample Return
  • token
  • sensor_id
  • since
JSONUse X-Auth-Token from authentication


Code Block
titleExample Output
collapsetrue
[    

    { "id":96556536,
      "created":"2019-09-27T20:45:42Z",
      "start_time":"2018-06-25T00:00:00Z",
      "end_time":"2018-06-25T00:00:00Z",
      "properties":{ 
         "nitrate-nitrite-inorganic-total-as-n-mgl":"4.16"

       },
      "type":"Feature",
      "geometry":{          "type":"Point",
         "coordinates":[ -90.645,42.5408333,0 ]
       },
      "stream_id":"28",
      "sensor_id":"22",
      "sensor_name":"IL_EPA_WQX-M-13"
   },
  ...
]



Code Block
titleGet Datapoints for Single Sensor
curl -X GET -H 'Content-Encoding: application/json' -H 'x-auth-token:token' --compressed 

...

'https://greatlakestogulf.org/geostreams/api/datapoints?sensor_id=22&since=

...

2018-06-01'

...

  • token
  • sensor_id
  • since

...