Importance of APIs in the Internet of Things

1,444 views
1,348 views

Published on

How to design an API for devices - when there's millions of them. Comparing the networking industry with web APIs.

Presented by Jacob Ideskog from Twobo Technologies at Nordic APIs in Trondheim, June 11 - 2013

Published in: Technology, Business
0 Comments
4 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,444
On SlideShare
0
From Embeds
0
Number of Embeds
523
Actions
Shares
0
Downloads
0
Comments
0
Likes
4
Embeds 0
No embeds

No notes for slide

Importance of APIs in the Internet of Things

  1. 1. Importance of APIs in the Internet of ThingsFrom Network APIs to the next big thingJacob Ideskog, Solution Architect@jacobideskogCopyright © 2013 Twobo Technologies AB. All rights reserved
  2. 2. Agenda History – this has happened before… The network industry REST Devices – services or APIs?Copyright © 2013 Twobo Technologies AB. All rights reserved.
  3. 3. Disruptive trendsCloudComputingSocialNetworksBigDataCopyright © 2013 Twobo Technologies AB. All rights reserved.Mobile
  4. 4. The Web, networking and the Internet of thingsCopyright © 2013 Twobo Technologies ABFreeWeb APIsTheNetworkingIndustryDevice APIsrpc/rmi
  5. 5. The Networking IdustryFrom SNMP to NETCONFCopyright © 2013 Twobo Technologies ABFreeWeb APIsTheNetworkingIndustryDevice APIsrpc/rmi
  6. 6. Virtualization - a game changer Moving a server from U.S.A. to India With maintained state What happened to the network?Copyright © 2012 - 2013 Twobo Technologies AB
  7. 7. Virtualization Not a new problem Just a new focus Solutions popped upCopyright © 2012 - 2013 Twobo Technologies ABvSwitchOpenFlowJSON REST
  8. 8. History again Let’s take one step back further The networking industry had this talk 10 year ago RFC 3535 Content: How does the industry Automate networkmanagement? SNMP has failed• CLI scripting• Proprietary drivers• Error handlingCopyright © 2012 - 2013 Twobo Technologies ABRFC 3535RFC 3535
  9. 9. History again The outcome of RFC 3535 NETCONF – RFC 6241 Two types of data with clear separation• Operational Data• Configurational Data Transactions• Implied Validation of input data• Ability to compare, even between devices Ease of use Backup / RestoreCopyright © 2013 Twobo Technologies AB. All rights reserved
  10. 10. NETCONF Configuration Pre-provisioning Operational Data RPCs / Actions All modelled in YANG (rfc6020)Copyright © 2013 Twobo Technologies AB. All rights reservedConfigurationOperational stateAction(eg. reboot){ interfaces interface eth0 ip 10.0.0.1 }{ interfaces interface eth0 rx_faults }
  11. 11. Web APIsI.e. RESTful APIsCopyright © 2013 Twobo Technologies AB. All rights reservedFreeWeb APIsTheNetworkingIndustryDevice APIsrpc/rmi
  12. 12. Web APIs Today: The most commonly used API architecture is REST REST: No uniform standard NOT A PROTOCOLCopyright © 2013 Twobo Technologies AB. All rights reserved
  13. 13. Resource or serviceCopyright © 2013 Twobo Technologies AB. All rights reserved http://martinfowler.com/articles/richardsonMaturityModel.htmlLevel 0: The Swamp of POXLevel 1: ResourceLevel 2: HTTP VerbsLevel 3: Hypermedia ControlsGlory of Rest
  14. 14. Level 0 Swamp of POXCopyright © 2013 Twobo Technologies AB. All rights reservedCopyright © 2013 Twobo Technologies AB. Allrights reservedPOST <getBook>POST <deleteUser><book ...<ok .../apiXML RPC all over again
  15. 15. Level 1 ResourcesURIsBut still XML messages as operationsCopyright © 2013 Twobo Technologies AB. Allrights reservedPOST <getBook>POST <deleteUser><book ...<ok .../books/2/users/24
  16. 16. Level 2 HTTP VerbsUtilizes the semantics of HTTPCopyright © 2013 Twobo Technologies AB. All rights reservedGET - Read a resourceHEAD – Read metadata about resourceOPTIONS – Read what operations are availablePOST – Add a new resource, or run operationPUT – Replace existing resource completelyDELETE – Remove resource(PATCH – Update existing resource in place)GET ?pagesize=A4DELETE200 OK <book ...201 No Content/books/2/users/32
  17. 17. Level 3 The Glory of REST HATEOAS Hypermedia As The Engine Of Application State Or simply: Hypermedia Let the Media Type tell you what to do Hyperlink, hyperlink hyperlinkCopyright © 2013 Twobo Technologies AB. All rights reserved
  18. 18. ExampleCopyright © 2013 Twobo Technologies AB. All rights reservedcurl –v http://localhost/stuff<stuff xmlns:tt=http://example.com/rest tt:rel=”/stuff"><more-stuff tt:rel="/stuff/more-stuff"/><other-stuff tt:=”/stuff/other-stuff"/><data><entry>Interesting 1</entry><entry>Interesting 2</entry></stuff>curl –v http://localhost/stuff/more-stuff<more-stuff xmlns:tt=http://example.com/rest tt:rel=”/stuff/more-stuff"><things tt:rel="/stuff/more-stuff/things"/></more-stuff>
  19. 19. Ring a bell?Copyright © 2013 Twobo Technologies AB. All rights reservedcurl –v http://localhost/v2/stuff<html><div id=“stuff”><a href=“/stuff/more-stuff”/><a href=“/stuff/other-stuff/><ol id=“data”><li id=“entry1”>Interesting 1</li><li id=“entry2”>Interesting 2</li></ol><form action=“/stuff” ><input type=“text” name=“value” /></form></div></html>
  20. 20. Device APIs But a device isn’t an APP What you are designing isn’t a user interface A system can contain Thousands / Millions / Billons of devices The device may be placed in odd locations Must be replaceableCopyright © 2013 Twobo Technologies AB. All rights reserved
  21. 21. Device APIsLetting your deviceBECOME an APICopyright © 2013 Twobo Technologies AB. All rights reservedFreeWeb APIsTheNetworkingIndustryDevice APIsrpc/rmi
  22. 22. Services High level abstractions Not directly map able to a single deviceCopyright © 2013 Twobo Technologies AB. All rights reservedSERVICEFuel optimizationSERVICEHealth assistanceSERVICEPlant wateringsystemCAR GPSStop lightsTurbo injectorThermometerCalendarMedicine dosageWeather servicesGarden sensorsWater tap
  23. 23. ServicesCopyright © 2013 Twobo Technologies AB. All rights reserved“Network Service Participation”
  24. 24. Example: Networks Network wide transactions All or nothing Setup VPN All participating Routersmust be updated ACIDCopyright © 2013 Twobo Technologies AB. All rights reservedTail-f:NCSCisco Juniper ALU CompassCustomer orders newVPN in Web PortalController calculates changesand updates relevant devicesIf one device fails to update configall of them roll back
  25. 25. An API for ThingsRequirements:1. Must be consumed by machines2. Replaceable Dump all settings Restore in other device3. RobustCopyright © 2013 Twobo Technologies AB. All rights reserved
  26. 26. An API for ThingsRequirements:1. Must be consumed by machinesCopyright © 2013 Twobo Technologies AB. All rights reservedResource basedLevel 2,5Clear separationof Configurationaland OperationaldataWhat you need is a DataModel => Think of it like a Site Map with meta-data about each sub-page
  27. 27. An API for ThingsCopyright © 2013 Twobo Technologies AB. All rights reservedRequirements:2. Replaceable Dump all settings Restore in other deviceDefined by data-modelNo side-effects ofconfiguration in otherconfiguration
  28. 28. An API for ThingsCopyright © 2013 Twobo Technologies AB. All rights reservedRequirements:3. Robust All or nothing No unexpected statesTransactionsCannot rely onordering of incomingdata
  29. 29. An API for ThingsMake sure your device can participate in theservices that will be the Internet of Things!Copyright © 2013 Twobo Technologies AB. All rights reserved
  30. 30. Summary The game-changers Learning for Networking (NETCONF) REST but not necessarily Hypermedia Devices are volatile!Copyright © 2013 Twobo Technologies AB. All rights reserved
  31. 31. Questions & Thanks@2botech@jacobideskogwww.2botech.comCopyright © 2013 Twobo Technologies AB.
  32. 32. Copyright © 2013 Twobo Technologies AB. All rights reserved

×