"Managing API Complexity". Matthew Flaming, Temboo
-
Upload
yandex -
Category
Technology
-
view
2.030 -
download
0
description
Transcript of "Managing API Complexity". Matthew Flaming, Temboo
![Page 1: "Managing API Complexity". Matthew Flaming, Temboo](https://reader033.fdocuments.us/reader033/viewer/2022052820/54b762bc4a79598a618b45d8/html5/thumbnails/1.jpg)
![Page 2: "Managing API Complexity". Matthew Flaming, Temboo](https://reader033.fdocuments.us/reader033/viewer/2022052820/54b762bc4a79598a618b45d8/html5/thumbnails/2.jpg)
COPYRIGHT TEMBOO 2013
Managing API Complexity
! Matthew Flaming
! Director of SW Development at Temboo.com
! Live in Moscow (thanks, YaC!)
![Page 3: "Managing API Complexity". Matthew Flaming, Temboo](https://reader033.fdocuments.us/reader033/viewer/2022052820/54b762bc4a79598a618b45d8/html5/thumbnails/3.jpg)
COPYRIGHT TEMBOO 2013
My Terrible Secret
! I hate APIs
! (except for yours)
![Page 4: "Managing API Complexity". Matthew Flaming, Temboo](https://reader033.fdocuments.us/reader033/viewer/2022052820/54b762bc4a79598a618b45d8/html5/thumbnails/4.jpg)
COPYRIGHT TEMBOO 2013
One API is Great
![Page 5: "Managing API Complexity". Matthew Flaming, Temboo](https://reader033.fdocuments.us/reader033/viewer/2022052820/54b762bc4a79598a618b45d8/html5/thumbnails/5.jpg)
COPYRIGHT TEMBOO 2013
Many APIs, not so much
![Page 6: "Managing API Complexity". Matthew Flaming, Temboo](https://reader033.fdocuments.us/reader033/viewer/2022052820/54b762bc4a79598a618b45d8/html5/thumbnails/6.jpg)
COPYRIGHT TEMBOO 2013
Where are all the apps?
! 9,970 APIs as of this morning • programmableweb.com/apis/directory
! There’s an explosion of amazing APIs on the web right now, but...
! Most apps only connect to a single API (or a handful of similar APIs)
![Page 7: "Managing API Complexity". Matthew Flaming, Temboo](https://reader033.fdocuments.us/reader033/viewer/2022052820/54b762bc4a79598a618b45d8/html5/thumbnails/7.jpg)
COPYRIGHT TEMBOO 2013
Two Problems
! How do I connect to this API?
! How do I make sure my app keeps working?
![Page 8: "Managing API Complexity". Matthew Flaming, Temboo](https://reader033.fdocuments.us/reader033/viewer/2022052820/54b762bc4a79598a618b45d8/html5/thumbnails/8.jpg)
COPYRIGHT TEMBOO 2013
New learning curve per API ! How does this API conceptually fit together?
! How does this API handle the details?
• Calling methods?
• Data formats? (JSON or XML?)
• Authentication?
• Language support?
• Dates? Boolean values? Pagination?
• Etc. etc.
![Page 9: "Managing API Complexity". Matthew Flaming, Temboo](https://reader033.fdocuments.us/reader033/viewer/2022052820/54b762bc4a79598a618b45d8/html5/thumbnails/9.jpg)
COPYRIGHT TEMBOO 2013
More fragility per API
! How to track API updates?
! How to test API integration points?
! How to effectively migrate between APIs?
![Page 10: "Managing API Complexity". Matthew Flaming, Temboo](https://reader033.fdocuments.us/reader033/viewer/2022052820/54b762bc4a79598a618b45d8/html5/thumbnails/10.jpg)
COPYRIGHT TEMBOO 2013
This is an API publisher problem too
! If you build it, they won’t (necessarily) come
! …and if they do, they might hate you for it
![Page 11: "Managing API Complexity". Matthew Flaming, Temboo](https://reader033.fdocuments.us/reader033/viewer/2022052820/54b762bc4a79598a618b45d8/html5/thumbnails/11.jpg)
COPYRIGHT TEMBOO 2013
How can API publishers help?
! Thinking different isn’t always a good thing • REST is (usually) best
• Oauth 2.0 or HTTP Basic authentication
• Support both JSON and XML
• Keep your implementation details private
![Page 12: "Managing API Complexity". Matthew Flaming, Temboo](https://reader033.fdocuments.us/reader033/viewer/2022052820/54b762bc4a79598a618b45d8/html5/thumbnails/12.jpg)
COPYRIGHT TEMBOO 2013
How can API publishers help?
! Understand that an API is a social contract • “It should keep working”
• Minimize churn
• Announce changes early, and loudly
• Bake in versioning
/myapi/v1.0/myresource
![Page 13: "Managing API Complexity". Matthew Flaming, Temboo](https://reader033.fdocuments.us/reader033/viewer/2022052820/54b762bc4a79598a618b45d8/html5/thumbnails/13.jpg)
COPYRIGHT TEMBOO 2013
How can API publishers help?
! Discoverability is your most important feature • Documentation
• WSDL… or not
• JSON Discovery
www.googleapis.com/discovery/v1/apis
• Client libraries
![Page 14: "Managing API Complexity". Matthew Flaming, Temboo](https://reader033.fdocuments.us/reader033/viewer/2022052820/54b762bc4a79598a618b45d8/html5/thumbnails/14.jpg)
COPYRIGHT TEMBOO 2013
How can API publishers help?
! Benefits of client libraries • Enforce API consistency
• Provide a test harness
• Reduce user friction
• Help you think like an API consumer
![Page 15: "Managing API Complexity". Matthew Flaming, Temboo](https://reader033.fdocuments.us/reader033/viewer/2022052820/54b762bc4a79598a618b45d8/html5/thumbnails/15.jpg)
COPYRIGHT TEMBOO 2013
Code generation is the answer Expose language-agnostic metadata
github.com/wornik/swagger-codegen
var findById = {! 'spec': {! "description" : ”Find pet by ID",! "path" : "/pet.{format}/{petId}",! "summary" : "Find pet by ID",! "method": "GET",! "params" : [swagger.pathParam("petId", "ID of pet", "string")],! "responseClass" : "Pet",! "nickname" : "getPetById"! },! 'action': function (req,res) {! …function body here…! }!};!
![Page 16: "Managing API Complexity". Matthew Flaming, Temboo](https://reader033.fdocuments.us/reader033/viewer/2022052820/54b762bc4a79598a618b45d8/html5/thumbnails/16.jpg)
COPYRIGHT TEMBOO 2013
Code generation is the answer Use metadata to generate client libraries
www.stringtemplate.org
/*!$description$!*/!var $nickname$ = function(! $params.fields:{paramName)$};separator=", "$,! callback, errorCallback) { ! ! var options = { !
!method: $method$, !!hostname: $host$, !!path: getReqPath($path$, $params$), !
}; ! var request = http.request(options, !
!function(response) { ! !responseHandler(response, callback,errorCallback); ! });!}!
![Page 17: "Managing API Complexity". Matthew Flaming, Temboo](https://reader033.fdocuments.us/reader033/viewer/2022052820/54b762bc4a79598a618b45d8/html5/thumbnails/17.jpg)
COPYRIGHT TEMBOO 2013
How can API publishers help?
! Make your APIs device-friendly • Worry about data size
• Provide alternatives to Oauth
![Page 18: "Managing API Complexity". Matthew Flaming, Temboo](https://reader033.fdocuments.us/reader033/viewer/2022052820/54b762bc4a79598a618b45d8/html5/thumbnails/18.jpg)
COPYRIGHT TEMBOO 2013
What about API consumers?
! That’s all great, but…
![Page 19: "Managing API Complexity". Matthew Flaming, Temboo](https://reader033.fdocuments.us/reader033/viewer/2022052820/54b762bc4a79598a618b45d8/html5/thumbnails/19.jpg)
COPYRIGHT TEMBOO 2013
What about API consumers?
! Keep API integrations abstract and modular
! Generalized open-source libraries
! API management platforms • We all love infrastructure virtualization…
• What about… code virtualization?
![Page 20: "Managing API Complexity". Matthew Flaming, Temboo](https://reader033.fdocuments.us/reader033/viewer/2022052820/54b762bc4a79598a618b45d8/html5/thumbnails/20.jpg)
COPYRIGHT TEMBOO 2013
Temboo
! Collects and normalizes APIs to give you one consistent interface (“Choreographies”)
! All the power of multiple APIs
! Just one learning curve
![Page 21: "Managing API Complexity". Matthew Flaming, Temboo](https://reader033.fdocuments.us/reader033/viewer/2022052820/54b762bc4a79598a618b45d8/html5/thumbnails/21.jpg)
COPYRIGHT TEMBOO 2013
Temboo
![Page 22: "Managing API Complexity". Matthew Flaming, Temboo](https://reader033.fdocuments.us/reader033/viewer/2022052820/54b762bc4a79598a618b45d8/html5/thumbnails/22.jpg)
COPYRIGHT TEMBOO 2013
Temboo
![Page 23: "Managing API Complexity". Matthew Flaming, Temboo](https://reader033.fdocuments.us/reader033/viewer/2022052820/54b762bc4a79598a618b45d8/html5/thumbnails/23.jpg)
COPYRIGHT TEMBOO 2013
Temboo
![Page 24: "Managing API Complexity". Matthew Flaming, Temboo](https://reader033.fdocuments.us/reader033/viewer/2022052820/54b762bc4a79598a618b45d8/html5/thumbnails/24.jpg)
COPYRIGHT TEMBOO 2013
Temboo
![Page 25: "Managing API Complexity". Matthew Flaming, Temboo](https://reader033.fdocuments.us/reader033/viewer/2022052820/54b762bc4a79598a618b45d8/html5/thumbnails/25.jpg)
COPYRIGHT TEMBOO 2013
Temboo
![Page 26: "Managing API Complexity". Matthew Flaming, Temboo](https://reader033.fdocuments.us/reader033/viewer/2022052820/54b762bc4a79598a618b45d8/html5/thumbnails/26.jpg)
COPYRIGHT TEMBOO 2013
Temboo
![Page 27: "Managing API Complexity". Matthew Flaming, Temboo](https://reader033.fdocuments.us/reader033/viewer/2022052820/54b762bc4a79598a618b45d8/html5/thumbnails/27.jpg)
COPYRIGHT TEMBOO 2013
Temboo
![Page 28: "Managing API Complexity". Matthew Flaming, Temboo](https://reader033.fdocuments.us/reader033/viewer/2022052820/54b762bc4a79598a618b45d8/html5/thumbnails/28.jpg)
COPYRIGHT TEMBOO 2013
Temboo
![Page 29: "Managing API Complexity". Matthew Flaming, Temboo](https://reader033.fdocuments.us/reader033/viewer/2022052820/54b762bc4a79598a618b45d8/html5/thumbnails/29.jpg)
COPYRIGHT TEMBOO 2013
Temboo
![Page 30: "Managing API Complexity". Matthew Flaming, Temboo](https://reader033.fdocuments.us/reader033/viewer/2022052820/54b762bc4a79598a618b45d8/html5/thumbnails/30.jpg)
COPYRIGHT TEMBOO 2013
Temboo
! Search Twitter (PHP) $session = new Temboo_Session('matthew', ’myApp', ’demo');!!// Instantiate the Choreo!$choreo = new Twitter_Search_Tweets($session);!!// Get an input object for the Choreo and set credential!$inputs = $choreo ->newInputs();!$inputs->setCredential('TwitterOAuthCredential');!!// Set inputs!$inputs->setQuery("Yac2013");!!// Execute Choreo and get results!$results = $choreo->execute($inputs)->getResults();!
![Page 31: "Managing API Complexity". Matthew Flaming, Temboo](https://reader033.fdocuments.us/reader033/viewer/2022052820/54b762bc4a79598a618b45d8/html5/thumbnails/31.jpg)
COPYRIGHT TEMBOO 2013
Temboo
! Search Flickr (PHP) $session = new Temboo_Session('matthew', ’myApp', ’demo');!!// Instantiate the Choreo!$choreo = new Flickr_Photos_SearchPhotos($session);!!// Get an input object for the Choreo and set credential!$inputs = $choreo ->newInputs();!$inputs->setCredential(’FlickrOAuthCredential');!!// Set inputs!$inputs->setText("Yac2013");!!// Execute Choreo and get results!$results = $choreo->execute($inputs)->getResults();!
![Page 32: "Managing API Complexity". Matthew Flaming, Temboo](https://reader033.fdocuments.us/reader033/viewer/2022052820/54b762bc4a79598a618b45d8/html5/thumbnails/32.jpg)
COPYRIGHT TEMBOO 2013
Temboo
! Search Dropbox (PHP) $session = new Temboo_Session('matthew', ’myApp', ’demo');!!// Instantiate the Choreo!$choreo = new Dropbox_FilesAndMetadata_SearchFilesAndFolders($session);!!// Get an input object for the Choreo and set credential!$inputs = $choreo ->newInputs();!$inputs->setCredential(’DropboxOAuthCredential');!!// Set inputs!$inputs->setQuery("Yac2013");!!// Execute Choreo and get results!$results = $choreo->execute($inputs)->getResults();!
![Page 33: "Managing API Complexity". Matthew Flaming, Temboo](https://reader033.fdocuments.us/reader033/viewer/2022052820/54b762bc4a79598a618b45d8/html5/thumbnails/33.jpg)
COPYRIGHT TEMBOO 2013
Temboo
! Search Dropbox (PHP) $session = new Temboo_Session('matthew', ’myApp', ’demo');!!// Instantiate the Choreo!$choreo = new Dropbox_FilesAndMetadata_SearchFilesAndFolders($session);!!// Get an input object for the Choreo and set credential!$inputs = $choreo ->newInputs();!$inputs->setCredential(’DropboxOAuthCredential');!!// Set inputs!$inputs->setQuery("Yac2013");!!// Execute Choreo and get results!$results = $choreo->execute($inputs)->getResults();!
![Page 34: "Managing API Complexity". Matthew Flaming, Temboo](https://reader033.fdocuments.us/reader033/viewer/2022052820/54b762bc4a79598a618b45d8/html5/thumbnails/34.jpg)
COPYRIGHT TEMBOO 2013
Temboo
! Search Foursquare (PHP) $session = new Temboo_Session('matthew', ’myApp', ’demo');!!// Instantiate the Choreo!$choreo = new Foursquare_Venues_SearchVenues($session);!!// Get an input object for the Choreo and set credential!$inputs = $choreo ->newInputs();!$inputs->setCredential(’FoursquareOAuthCredential');!!$inputs->setLatitude("40.7186300");!$inputs->setLongitude("-74.055840");!!// Execute Choreo and get results!$results = $choreo->execute($inputs)->getResults();!
![Page 35: "Managing API Complexity". Matthew Flaming, Temboo](https://reader033.fdocuments.us/reader033/viewer/2022052820/54b762bc4a79598a618b45d8/html5/thumbnails/35.jpg)
COPYRIGHT TEMBOO 2013
Temboo
Choreography
Metadata
PHP template Node.js template Ruby template iOS template Python template
Java template cURL template Arduino template
![Page 36: "Managing API Complexity". Matthew Flaming, Temboo](https://reader033.fdocuments.us/reader033/viewer/2022052820/54b762bc4a79598a618b45d8/html5/thumbnails/36.jpg)
COPYRIGHT TEMBOO 2013
Temboo
Choreography
Metadata
PHP template Node.js template Ruby template iOS template Python template
Java template cURL template Arduino template
Patch
![Page 37: "Managing API Complexity". Matthew Flaming, Temboo](https://reader033.fdocuments.us/reader033/viewer/2022052820/54b762bc4a79598a618b45d8/html5/thumbnails/37.jpg)
COPYRIGHT TEMBOO 2013
Automation will transform APIs
! Code generation + frameworks
! Increasing standardization
! Decreasing friction
! An exciting time to be a developer