API4INSPIRE

Documentation of APIs for INSPIRE

Example Queries

All these examples are not urlencoded, for readability. If you use these examples, don’t forget to urlencode. On the Implementations you can find demo services to try them out.

Greater than and smaller than

All things with an Id greater equal 5 and lessequal 20:

v1.1/Things?$filter=id ge 15 and id le 20

Overlapping time frames

The phenomenonTime and result of the first 1000 observations, ordered by phenomenonTime that overlap with the time frame from 2017-10-10 07:00:00 UTC to 2017-10-11 07:00:00 UTC (1 day):

v1.1/Observations
  ?$orderby=phenomenonTime asc
  &$top=1000
  &$select=phenomenonTime, result
  &$filter=overlaps(phenomenonTime, 2017-10-10T07:00:00Z/2017-10-11T07:00:00Z)

Don’t forget to URL-Encode.

The previous day

The observations of a Datastream, for the last day:

Datastreams(1)/Observations?$filter=phenomenonTime gt now() sub duration'P1D'

The last x days

The observations of a Datastream, for the last days, where the number of days is configured in properties/days of the Datastream:

Datastreams(1)/Observations?$filter=phenomenonTime gt now() sub duration'P1D' mul Datastream/properties/days

Odd or even

All observations with an even result

Observations?$filter=result mod 2 eq 0

Datastreams that have data for the ObservedProperty with id 1

Datastreams?$filter=ObservedProperty/@iot.id eq 1

ObservedProperties that are measured at the same station as the ObservedProperty with name Temperature

ObservedProperties?$filter=Datastreams/Thing/Datastreams/ObservedProperty/name eq 'Temperature'

Threshold detection

Filtering Observations where result is greater than a threshold stored in the properties of their Datastream. The “add 0” is to indicate we want to use a numeric comparison. Since both Observations/result and Datastreams/properties/max can be anything, the server would otherwise default to a (safe) string-comparison.

Observations?$filter=result gt Datastream/properties/max add 0

Ordering by function

Functions work for Ordering

Datastreams?$orderby=length(name) desc

Give me EVERYTHING!

All things, with their current Locations and Datastreams, and for those Datastreams the ObservedProperty and the last Observation:

v1.1/Things
  ?$select=name,description,@iot.id
  &$expand=
    Locations
      ($select=name,description,location,@iot.id)
    ,Datastreams
      ($select=name,description,@iot.id
      ;$expand=
        Sensor
          ($select=name,description,@iot.id)
        ,ObservedProperty
          ($select=name,description,@iot.id)
        ,Observations
          ($select=result,phenomenonTime,@iot.id
          ;$orderby=phenomenonTime%20desc
          ;$top=2
          )
      )

All stations at the river Rhine:

https://lubw.k8s.ilt-dmz.iosb.fraunhofer.de/v1.1/Things?$filter=properties/type eq 'station' and properties/gewaesser.Location/name eq 'Rhein'

All stations at a river that flows into the Rhine:

https://lubw.k8s.ilt-dmz.iosb.fraunhofer.de/v1.1/Things?$filter=properties/type eq 'station' and properties/gewaesser.Location/properties/sink.Location/name eq 'Rhein'