Turbocharge your API strategy with SDK

14
Ramesh Elaiyavalli – Chief Operating Officer – Phone.com Turbocharge your API Strategy with SDK

Transcript of Turbocharge your API strategy with SDK

Page 1: Turbocharge your API strategy with SDK

RameshElaiyavalli– ChiefOperatingOfficer– Phone.com

TurbochargeyourAPIStrategywithSDK

Page 2: Turbocharge your API strategy with SDK

TurbochargeyourAPIStrategywithSDK

• WhatisanSDK?

• SDK=SoftwareDevelopmentKit

• Afile/librarythatprovidesstructuredaccesstoAPIfunctions.

Page 3: Turbocharge your API strategy with SDK

DesignConsiderationsforSDK• APIcomplexity• CostconsiderationforSDK• Concurrency,scalability,errortrackinganddebugging,levelofcompleteness,performanceandlatency.

• Customerbaseandcustomerretention• Intendeduserbasesizeandsophistication• Homeorcommunitymade• Customersupportaspects

Page 4: Turbocharge your API strategy with SDK

TropoSDK<?php/***AsampleapplicationthatdemonstratestheuseoftheTropoPHP package.*@copyright2010MarkJ.Head(http://www.voiceingov.org)*///IncludeTropoclasses.

require('tropo.class.php');//<- LoadSDK

$tropo=newTropo();//<- Initialization$tropo->Say("HelloWorld!");// <- simplecalltoAPIviaanobjectmethod$tropo->RenderJson();?>

Page 5: Turbocharge your API strategy with SDK

Phone.comAPINoSDK

<?php

//UsingaGenericHTTPLibrary– NOTANSDK

$client=new\GuzzleHttp\Client(['base_uri'=>'https://api.phone.com/v4', //<-InitializeAPIlocation'headers'=>['Authorization' =>"Bearer$token"]//<- ProvideAuthentication

]);

//CallAPIFunction toListAllAddressBookContacts$response=$client->get(’/accounts/123/extensions/456/contacts');

Page 6: Turbocharge your API strategy with SDK

OrThisWayMicroservices

<?php$url="https://v1.api.phone.com/contacts/?limit=5&offset=0";

$ch=curl_init();//<- InitializeCURLandsetHTTPOptionscurl_setopt($ch, CURLOPT_URL,$url);curl_setopt($ch, CURLOPT_HTTPAUTH,CURLAUTH_BASIC);curl_setopt($ch, CURLOPT_USERPWD,"username:password"); //<- Authenticationcurl_setopt($ch, CURLOPT_HEADER,true);curl_setopt($ch, CURLOPT_HTTPHEADER,array('Content-Type:application/json'));curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);

$result=curl_exec($ch);// <- SendAPIRequest$info=curl_getinfo($ch);//<- Getresponse fromAPIvendorcurl_close($ch);

if($info['http_code'] ==200){echo$result;}

Page 7: Turbocharge your API strategy with SDK

SowhySDK?• HideComplexities&reducefrictiontoadopt.• AbstractionLayer– Canhelpkeepcodeintegrityifyouswitchvendors

• MightrequireyetanotherabstractionlayerontopofvendorSDK

• SimplertochangeAPIversion• Providehigherlevel• FunctionalitybusinesslogicinsteadofmicrolevelAPI.

• MobileAppscanleverageSDKdirectly.

Page 8: Turbocharge your API strategy with SDK

WhyNOTSDK?

• BadSDKmaketheuseoftheAPImorecomplicated.

• LessvisibilitytowhatAPIfunctionsareused• Morecodemorebugs• NeedforongoingmaintenanceforSDKontopofAPIforallthelanguagesandplatforms.

• NotallSDKsareofficiallycreatedorsupportedbytheAPIvendoritself

• Maintaindocumentationandusageexamples.

Page 9: Turbocharge your API strategy with SDK

EdgeCases

• ComplexAPIstargetinglargelowproficiencydeveloperaudience.– SureitisbettertoprovideSDK.

• SimpleAPItargetinghighproficiencysmalldeveloperaudience– Probablyawasteoftime.

Page 10: Turbocharge your API strategy with SDK

CommunityorHomeBuilt

• Community– Nicetime&costsaver– ifbuiltnicely– Quickdeveloperswouldlikethechallenge– Makesuretocontributeandhelpfindbugs– KeepupdatingwhenreleasingnewAPIversions

• Home– Higherinvestment– mayreducewithautomation.– Fullcontroloverfunctionalityandstructure– KeepupdatingwhenreleasingnewAPIversions

Page 11: Turbocharge your API strategy with SDK

ToSDKornot?

• Pros– CanhelpinhidingsomeAPIcomplexities– Createdanabstractionlayer– Canhelpcustomersupport– Hidecomplexitiesinlargeprojects

• Cons– Mighthidetoomuch– Hardertosupportifnotcreatedbyvendor

Page 12: Turbocharge your API strategy with SDK

Othertools

• Samplecodeindifferentlanguagesiskey• Makesitrealeasytostart

Page 13: Turbocharge your API strategy with SDK

Dashboard

Page 14: Turbocharge your API strategy with SDK

ControlPanel