APIs are proliferating on the web, providing app developers with ready access to a wide range of data and services, yet very few apps take advantage of more than one or two API providers. Arbitrary inconsistencies between APIs -- from authentication to input/output formats to details as small as timestamps or pagination -- mean every new API brings its own unnecessarily redundent learning curve, draining developer's most precious resource: time.
Temboo is part of an emerging class of services for managing and scaling API usage. By NORMALIZING access to APIs (as well as their associated documentation and credentials) these services do for development what PaaS and server virtualization have already done for app deployment and infrastructure. "Code virtualization", whereby all the tedious details of API access are abstracted away in standardized cloud-based processes, will free developers to spend their time writing only the code that actually makes their app unique. And that means more unique apps for everyone.
6. 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)
7. COPYRIGHT TEMBOO 2013
Two Problems
! âŻHow do I connect to this API?
! âŻHow do I make sure my app keeps working?
8. 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.
9. COPYRIGHT TEMBOO 2013
More fragility per API
! âŻHow to track API updates?
! âŻHow to test API integration points?
! âŻHow to effectively migrate between APIs?
10. 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
11. 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
12. 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
13. 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
14. 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
15. 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âŚ!
}!
};!
16. 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); !
});!
}!
17. COPYRIGHT TEMBOO 2013
How can API publishers help?
! âŻMake your APIs device-friendly
â˘âŻWorry about data size
â˘âŻProvide alternatives to Oauth
19. 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?
20. 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
30. 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();!
31. 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();!
32. 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();!
33. 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();!
34. 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();!