OGC SensorThings API Get Started Webinar Series #3 of 4. (Dec 10 2015)
Title: RESTful Pattern for IoT API
More to come:
#4: Connect Sensors and IoT Devices to SensorThings API (Dec 17th 2015)
Register our webinar here: http://sensorup.com/#signup
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
OGC SensorThings API Tutorial #3 - RESTful Pattern for IoT API
1. OGC SensorThings API
Tutorial #3 - RESTful Pattern for IoT API
0.23 litre/minute
0.25 litre/minute
0.27 litre/minuteRH: 85 %
Temp: 18 Celsius
Dr. Steve Liang
Chair, OGC SensorThings API Standard Working Group
Founder and CEO, SensorUp Inc.
Associate Professor, University of Calgary
3. sensorup.com@sensorup
About Dr. Steve Liang
• Associate Professor, Geomatics Engineering, Uni. Calgary
• AITF-Microsoft Industry Chair on Open Sensor Web
• Chair OGC SensorThings API Standard Working Group
• Co-Chair OGC Sensor Web Enablement Domain Working Group
• N.A. Chair, OGC University Domain Working Group
• Rapporteur, ITU-T SG12/11 on Internet of Things Test Specifications
• Founder and CEO, SensorUp Inc, a University of Calgary startup
(http://www.sensorup.com)
4. sensorup.com@sensorup
About SensorUp
• We are a world leader in OGC Sensor Web and IoT
• We are leading several international IoT standard
development efforts (OGC and ITU-T)
• We developed world’s first OGC SensorThings API
implementation
6. Prerequisites
• Basic knowledge of REST (REpresentational State Transfer)
• https://en.wikipedia.org/wiki/Representational_state_transfer
• Basic knowledge of JSON (JavaScript Object Notation)
• http://www.json.org/
7. Before We Start
• It’s all about LINKS!
• great discoverability
• great for dynamic use cases
• efficient and great developer experiences
• big data analytics friendly
• Uniform and Consistent Pattern
8. SensorThings Entities
Common Control Information
8
Annotation Definition Data type Multiplicity
@iot.id system generated identifier Any 1
@iot.selfLink absolute URL of an entity URL 1
@iot.navigationLink link leading to related entities URL 1…*
21. Evaluating System Query Options
21
• Prior to applying any server-driven paging:
• $filter
• $orderby
• $skip
• $top
• After applying any server-driven paging:
• $expand
• $select
22. The $expand system query option indicates the related entities to
be represented inline.
Über flexibility!
Example 1:
http://example.org/v1.0/Things?$expand=Datastreams
returns the entity set of Things as well as each of the Datastreams
associated with each Thing entity
$expand
23. E x a m p l e 2 : http://example.org/v1.0/Things?
$expand=Datastreams/ObservedProperty returns the
collection of Things, the Datastreams associated with each
Thing, and the ObservedProperty associated with each
Datastream.
Example 3: http://example.org/v1.0/Datastreams(1)?
$expand=Observations,ObservedProperty returns the
Datastream whose id is 1 as well as the Observations and
ObservedProperty associated with this Datastream.
24. The $select system query option requests that the service to return
only the properties explicitly requested by the client.
E x a m p l e 1 : http://example.org/v1.0/Observations?
$select=result,resultTime
$select
Great for performance! Reduce
response time and data size.
25. E x a m p l e 1 : http://example.org/v1.0/Observations?
$resultFormat=dataArray
$resultFormat=dataArray
Great for performance! Reduce
response time and data size.
26. $orderby
• Example 1: http://examples.com/v1.0/
Observations?$orderby=result returns all
Observations ordered by the result property in
ascending order.
27. Example 1: http://example.org/v1.0/Things?$top=5 returns
only the first five entities in the Things collection.
Example 2: http://example.org/v1.0/Observations?$top=5&
$orderby=phenomenonTime desc returns the first five
Observation entries after sorted by the phenomenonTime property in
descending order.
Note: if the $top value exceeds the service-driven pagination limitation
(i.e., the largest number of entities the service can return in a single
response), the $top query option should be discarded and the
pagination limitation shall be imposed.
$top
28. The $skip system query option specifies a non-negative integer n that
excludes the first n items of the queried collection from the result. The
service returns items starting at position n+1.
Example 1: http://example.org/v1.0/Things?$skip=5 returns
Thing entities starting with the sixth Thing entity in the Things
collection.
Where $top and $skip are used together, $skip SHALL be applied
before $top, regardless of the order in which they appear in the
request.
If no unique ordering is imposed through an $orderby query option,
the service SHALL impose a stable ordering across requests that include
$skip.
$skip
29. A URI with a $filter query option identifies a subset of the
entries from the collection of entries identified by the resource path
of the URI. The subset is determined by selecting only the entries
that satisfy the predicate expression specified by the $filter.
The value of the $filter option is a Boolean expression.
The expression language that is used in $filter operators
supports references to properties and literals. The literal values
can be strings enclosed in single quotes, numbers and boolean
values (true or false) or datetime values represented as ISO 8601
time string.
$filter