Automating Business Processes with APIs

Preview:

Citation preview

Automating Business Processes with APIs

SaulCaganoffCTO,Sixtree

@scaganoff @APIdaysAU

The Web is Now Programmable

• WeneedtotalkaboutconsumingAPIs• EachAPIwillhavethousandsormillionsofconsumers• Enterprisedigitalinitiatives– lean,SaaS,PaaS,IaaS• HowtoenabletheComposableEnterprise?

SaaS - Different Levels of Specialization

• Infrastructure– storage,compute,management,integration• Commodity – people,places,things,payment,security…• Functional – sales,marketing,servicemanagement,financial,humanresources…

• Industry – healthcare,education,supply-chain…• Youruniquebusinessvaluedependsonhowyouintegrateandoperatealltheseservices– Theend-to-endbusinessprocess

iPaaS & Cloud BPM

Consumer

Enterprise CloudBPM

DataSync

This is what you want…• Thebusinessprocessensemble• CoordinationbetweenprocessandAPI?• APIisconstrainedbyitsunderlyingstatemodel• BusinessProcesshasitsowngoaltoachieve

This is what you get…

• EachSaaSisbuiltasanisland…orwithpointintegrations

• Notdesignedforintegration• Anawfullotofpollinggoingon

“We’vegotalongwaytogo”- @njyx

E.g. Bookstore

Finance

Sales

Fulfilment

Product

Customer

End-to-end Process

?

State: the “S” in REST

• Created• Composed• Addressed• Quoted• Paid• Confirmed• Declined• Cancelled

Created Populated Addressed Quoted

PaidDeclined ConfirmedCancelled

AddItem

AddItem

RemoveItem

Accepted

AddCreditCardDetails

AddAddress

CalculateCost

Declined

AddCreditCardDetails

Cancel Cancel Cancel Cancel

Cancel

HATEOAS

• StateModel• BusinessProcess=apaththroughthestatemodel• APIAffordances– Exposehyperlinksthatrepresentavailablestatetransitions

HATEOAS

EmptyCart

FullCart

Quoted

Paid

POST/cart

PUT/cart/:id{book:…}

PUT/cart/:id{book:…}

DELETE/cart/:id/books/:id

PUT/cart/:id{address:…}

POST/payments{cart:…,card:{…}}

Commands{create:{cart:…}…}

{add:{cart:…,book: {…}}..}

{add:{cart:…,book: {…}}..}

{del:{cart:…,book: {…}}..}

{quoted:{cart:…}…}

{paid:{cart:…}…}

Events(EATNOAS)

HATEOAS and Events• StateModel• BusinessProcess=apaththroughthestatemodel• Dualitybetweenstatetransitionsandevents• Anexternalobservercaninferthestateofaresourcefromitsevent-stream– Thisistheessenceofevent-sourcing&CQRS

• Affordances– Exposehyperlinksthatrepresentavailablestatetransitions– Publisheventsthatnotifyactualstatetransitions

Event Transports: Syndication• APIexposeslistofevents– e.g.anRSS/atomfeed• Consumersdoallthehardwork:– Subscription– StateManagement(whereamIupto?)– Retries

• Positives– Veryeasy…well-knownpattern

• Negatives– Polling– Highlatency

Event Transports: WebHooks• ServicePOSTseventstosubscribers• Publishersdoallthehardwork:– Subscribermanagement– Consumersmustprovideanendpoint

• Positives– Notpolling,relativelylowerlatency

• Negatives– Subscriptionmanagement&guaranteeddeliverymustbedoneyourself– Reliability requirescoordinationbetweenpublisher&subscriber

Check out RESTHooks

• SponsoredbyZapier• WebHooks with• RESTful SubscriptionManagement

resthooks.org

Notification Services

End-to-end Process

UpdateInventory

ProcessPayment

InitiateFulfilment

UpdateFinancials

CompleteOrder

Affordances for Business Automation

• HaveanexplicitStateModel–Withpublishedhypermediacontrols

• Trackchanges– Allowqueryofchangessincelast“poll”

• Evenbetter- notifychanges– Eventstreams–WebHooks orRESTHooks– NotificationServices

• Considertheimportanceofeventreliability

Recommended