Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Just Gimme the Data!

Just Gimme the Data!

A session by Jason E Marshall at Syntax Code & Craft Convention 2016

Syntax Conference

May 06, 2016
Tweet

More Decks by Syntax Conference

Other Decks in Technology

Transcript

  1. Jason E. Marshall The Baldwin Group – Office of Coastal

    Management "We're entering a new world in which data may be more important than software." - Tim O'Reilly
  2. The Data Access Problem  No standard structure across silos….

     No standard access methods…  Adaptor Pattern | ETL Pattern
  3. The data integration project… The data I want The way

    they give it The way I need it My adaptors
  4. OpenData Protocol  “An open protocol to allow the creation

    and consumption of queryable and interoperable RESTful APIs in a simple and standard way.”  Odata.org
  5. Open Protocol  Open Community  GitHub (main), StackExchange, Twitter,

    Slack, Google Discussions, etc…  Standardized  Organization for the Advancement of Structured Information Standards (OASIS)  Various stacks  Odata.net, Olingo (java),
  6. The gist… {HttpVerb} {theApi} / {theEntity} ? {doSomething} ..with whatever…

    …to what… Relate entities Select fields Filter & Search Format result Custom functions …etc… Do what… Get Post Put Delete Patch …etc… …options People Places Things Objects Stuff …etc… People API Places API Things API This API That API …etc…
  7. Do What – the verbs… HTTP Verb Entity operation 

    GET  POST/PUT  DELETE  PATCH  BATCH  Read  Create  Delete  Update  Do several of these at once
  8. Do Something… query options  $select  $expand  $search

     $filter  $orderby  $format  $count  $skip, $top  …there are more…  What attributes to get  Get related entities  Find things in entities  Filter entities  Sorting  Result type (ie: json)  How many entities  Paging & navigation  .. I don’t have time for…
  9. $select  CSV of properties to return  Use like

    SQL select clause  ... /People?$select=UserName,FirstName,LastName
  10. $search  $search - restricts the result to include only

    those entities matching the specified search expression.  /People?$search=Scott
  11. $filter  Comparison operators  Eq, ne, has, Gt, ge,

    lt, le  Logical operators  and, or, not  Lambda  any, all  Arithmetic operators  add, sub, mul, div, mod  Grouping (operations)  (price sub 5) gt 10
  12. Built-in functions  String functions  contains,  tolower/upper 

    substring  concat…etc…  Date functions  now  date  year, month, day, hour minute, etc..  Math functions  Round, floor, ceiling  Type functions  cast, isof…  Geographic functions  distance  length  intersections
  13. Your custom functions  Roll your own functions  Use

    geographic search to find airports  /GetNearestAirport(lat = 33, lon = -118)
  14. Demo…but first… Postman  Chrome app for testing APIs 

    https://www.getpostman.com  Collections & environment settings exportable  Automate with newman  https://www.npmjs.com/package/newman
  15. Demo – Digging in  Getting properties  Filtering &

    Searching  Sorting  Client-side paging & counts  Expanding related entities  Selecting specific properties  Full Metadata  Casting types
  16. Batch Requests (no demo – yet)  Batch requests allow

    grouping multiple operations into a single HTTP request payload.  See: http://www.odata.org/getting-started/advanced- tutorial/#batch
  17. Sniffing the page for sources…  BUT WAIT – here’s

    another link!  https://coast.noaa.gov/arcgis/rest/services/Hurricanes/ AllStorms/MapServer/0/query?f=json&returnGeometry =true&outSR=4326&where=STORMID%20IN%20(SELE CT%20STORMID%20FROM%20WebMerc.get_StormId sForGeometry(default,default,default,-1,2000,%27- 8531595.349078232%204202202.0670058485%27,120380) )&outFields=STORMID,%20Display_StormName,Begin ObservationTime,BEGINLAT,BEGINLON,MinPressure,S affirSimpsonScale,DateAndTime,Display_DateAndTime ,Display_NormalizedMSW,Display_MinPressure,Segme ntOrder,ObjectId&callback=GetMeSomeHurricanes
  18. OpenData Protocol  “An open protocol to allow the creation

    and consumption of queryable and interoperable RESTful APIs in a simple and standard way.” Umm… hurricanes…?