Environment Agency river levels

The API description from the Envirionment Agency (https://environment.data.gov.uk/flood-monitoring/doc/reference) states other URL:

Root-URL {root}:

http://environment.data.gov.uk/flood-monitoring

All measures available from a particular Station:

{root}/id/stations/{id}/measures 

With your ID E14120 you get a JSON like this:

{ 
  "@context" : "http://environment.data.gov.uk/flood-monitoring/meta/context.jsonld" ,
  "meta" : { 
    "publisher" : "Environment Agency" ,
    "licence" : "http://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/" ,
    "documentation" : "http://environment.data.gov.uk/flood-monitoring/doc/reference" ,
    "version" : "0.9" ,
    "comment" : "Status: Beta service" ,
    "hasFormat" : [ "http://environment.data.gov.uk/flood-monitoring/id/stations/E14120/measures.csv", "http://environment.data.gov.uk/flood-monitoring/id/stations/E14120/measures.rdf", "http://environment.data.gov.uk/flood-monitoring/id/stations/E14120/measures.ttl", "http://environment.data.gov.uk/flood-monitoring/id/stations/E14120/measures.html" ]
  }
   ,
  "items" : [ { 
    "@id" : "http://environment.data.gov.uk/flood-monitoring/id/measures/E14120-level-stage-i-15_min-mAOD" ,
    "datumType" : "http://environment.data.gov.uk/flood-monitoring/def/core/datumAOD" ,
    "label" : "TOTTON RL - level-stage-i-15_min-mAOD" ,
    "latestReading" : { 
      "@id" : "http://environment.data.gov.uk/flood-monitoring/data/readings/E14120-level-stage-i-15_min-mAOD/2018-03-21T04-30-00Z" ,
      "date" : "2018-03-21" ,
      "dateTime" : "2018-03-21T04:30:00Z" ,
      "measure" : "http://environment.data.gov.uk/flood-monitoring/id/measures/E14120-level-stage-i-15_min-mAOD" ,
      "value" : 1.596
    }
     ,
    "notation" : "E14120-level-stage-i-15_min-mAOD" ,
    "parameter" : "level" ,
    "parameterName" : "Water Level" ,
    "period" : 900 ,
    "qualifier" : "Stage" ,
    "station" : "http://environment.data.gov.uk/flood-monitoring/id/stations/E14120" ,
    "stationReference" : "E14120" ,
    "unit" : "http://qudt.org/1.1/vocab/unit#Meter" ,
    "unitName" : "mAOD" ,
    "valueType" : "instantaneous"
  }
   ]
}

With

JSONPATH($.items[0].latestReading.value)

you get the value, but I get it also in square brackets (checked on http://jsonpath.com/)…

Did a quick search for solution of the square brackets probloem but didn’t find one…

Andreas

Edit: Maybe this could give you a hint…

1 Like