Stève Sfartz, Cisco DevNet
API Architect and Developer Advocates Manager
stsfartz@cisco.com
API World 2018
Emulators as an Emerging Best
Practice for API Providers
© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
• API Veteran, Hobbyist Coder, Hands-On Architect
• Building code samples & dev tools, provide feedback, fill gaps
• Manager of a WW team of Developer Evangelists
• Application Development Practices (IoT, Collab, Cloud, DevOps)
• Technical lead for the Cisco « API Style Guide »
• What excites me? Providing great Developer eXperiences
About me: //Cisco/DevNet/SteveSfartz
© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
• 500K+ members
• Dev Centers, Labs, Sandboxes
• Tutos
Join DevNet
twitter: @CiscoDevNet
github: @CiscoDevNet
webex: stsfartz@cisco.com
twitter: @SteveSfartz
github: @ObjectIsAdvantag
© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
Industry trends, Live demos, Lessons learnt
Emulators as an Emerging Best
Practice for API Providers
© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
• Containers -> deploy everywhere as a ‘black-box’
• CI/CD pipelines -> don’t break my flow
• Sandboxes -> give me access
• Serverless -> test and debug locally
Industry Trends & Developer Experience
© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
Enhance the user experience
in Meeetings Rooms
• People Count
• Administration APIs
• Custom UI controls for IoT
Sandboxes at Cisco DevNet
Webex RoomKit
© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
In-Room Controls Simulator
https://controls-editor.herokuapp.com/playground.html?virtualroom
End-to-end enriched
User Experience for
Meeting Rooms
• In-Room Control
• Node.js jsxapi
© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
Prototype with the RoomKit Sandboxes
© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
Coding for Serverless Platforms
© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
Coding for Serverless Platforms
© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
• Cisco Tropo is « telephony platform as a service »
• In-bound / out-bound Calls and SMS
• REST API endpoint
• Runs 5 languages as Serverless (JS, Python, Java, Groovy, PHP)
• Feedback from one year of evangelism
• hackathons, meetups, tutorials
• great platform
• bad debugging experience
An Emulator for Tropo Serverless Platform
© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
IVR script sample: auto-attendant
© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
Running Tropo Script locally
© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
• « Think big, Start small »
• Start from use cases
• « check scripts won’t break »
• « debug locally »
• Prototype / Evaluate / Arbitrate
• A Javascript emulator that mimics the platform
• 2 days to prototype during a DevNet Hack-a-tone
• 5 days to beta running all scripts (17 commits total)
• https://github.com/ObjectIsAdvantag/tropo-emulator-js
Lessons learnt building the Tropo Emulator
© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
Taking emulators to the next stage
https://github.com/ObjectIsAdvantag/tropo-ready-vscode
© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
• Providing an emulator opens a world of possibilities
• Better if opensource
• Visual Studio extension
• Live running by exposing local scripts to Tropo cloud
• 5 days, started with a Hack-a-tone again
• https://github.com/ObjectIsAdvantag/tropo-ready-vscode
Lessons learnt
© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
• A twin of your API
• Fully operational
• Generally NOT fully-featured
• Implementing one or several use cases
• Built to help your API consumers tests & debug
What’s an API emulator
© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
‘Your App’
now with Cisco
Cloud Collab!
Webex Teams APIs
extend Cisco Cloud Collaboration
GET
POST
DELETE
PUT /Rooms
/Memberships
/Messages
/Teams
/People
/Webhooks
© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
Webex API Emulator
https://github.com/ObjectIsAdvantag/webex-api-emulator
© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
Meet the Webex API Emulator
© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
Webex Teams Bot Architecture
 Register webhook events
• Messages / created
 Memberships / created
 As events happen in spaces,
receive notifications from
Webex
 Security tips
 Select spaces to fire from via
a webhook filter
 Check on user’s email domain
in your code
 Check webhook payload
signature via a shared secret
Webex
cloud platform
1. interacts in spaces
via a Teams client
Webex Teams
User
Your bot code running
on-premises or on in the cloud
2. posts notifications to
registered Webhooks
3. posts back messages
as notifications fly in
Publicly accessible
bot endpoint
© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
1. Testing (devops)
2. QA (non-regression, versioning)
3. Experimentating (API design, vNext)
4. Backup (training in restricted environments)
Uses cases for API Emulators
© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
• Scope
• Think big, Start small
• Document the use cases you want to cover
• Design your emulator
• Keep it light (in-memory persistance)
• Hyper quick to implement: couple of days
• Build
• Pick a raw HTTP framework to have maximum flexibility to mimic your
payloads
Lessons learnt
© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
• Are there alternatives?
- API Emulator vs Mocking
- API Emulator vs Service Virtualization
• How to compare ?
- Start from your use cases!
Thoughs
© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
• Who are the customers of your API emulator?
- your developer community
- Internally (Product Management)
Thoughts
© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
• Seriously consider adding Emulator(s) to your API Product
• Narrow the use cases your emulator will cover
• Build it in hours/days, not weeks/months
• Opensource it: building block for other use cases & tools
• Observe how your developer community leverages it
• Add a disclaimer (best-effort)
Wrapup
© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
• Webex Emulator
• https://github.com/ObjectIsAdvantag/webex-api-emulator
• Tropo Emulator
• https://github.com/ObjectIsAdvantag/tropo-emulator-js
• Tropo-Ready plugin for Visual Studio code
• https://github.com/ObjectIsAdvantag/tropo-ready-vscode
• DevNet Code Exchange
• https://developer.cisco.com/codeexchange/
Resources
© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
• 500K+ members
• Dev Centers, Labs, Sandboxes
• Tutos
Join DevNet
twitter: @CiscoDevNet
webex: stsfartz@cisco.com
twitter: @SteveSfartz
github: @ObjectIsAdvantag
© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
Thank you

Emulators as an Emerging Best Practice for API Providers

  • 1.
    Stève Sfartz, CiscoDevNet API Architect and Developer Advocates Manager stsfartz@cisco.com API World 2018 Emulators as an Emerging Best Practice for API Providers
  • 2.
    © 2018 Ciscoand/or its affiliates. All rights reserved. Cisco Confidential • API Veteran, Hobbyist Coder, Hands-On Architect • Building code samples & dev tools, provide feedback, fill gaps • Manager of a WW team of Developer Evangelists • Application Development Practices (IoT, Collab, Cloud, DevOps) • Technical lead for the Cisco « API Style Guide » • What excites me? Providing great Developer eXperiences About me: //Cisco/DevNet/SteveSfartz
  • 3.
    © 2018 Ciscoand/or its affiliates. All rights reserved. Cisco Confidential • 500K+ members • Dev Centers, Labs, Sandboxes • Tutos Join DevNet twitter: @CiscoDevNet github: @CiscoDevNet webex: stsfartz@cisco.com twitter: @SteveSfartz github: @ObjectIsAdvantag
  • 4.
    © 2018 Ciscoand/or its affiliates. All rights reserved. Cisco Confidential Industry trends, Live demos, Lessons learnt Emulators as an Emerging Best Practice for API Providers
  • 5.
    © 2018 Ciscoand/or its affiliates. All rights reserved. Cisco Confidential • Containers -> deploy everywhere as a ‘black-box’ • CI/CD pipelines -> don’t break my flow • Sandboxes -> give me access • Serverless -> test and debug locally Industry Trends & Developer Experience
  • 6.
    © 2018 Ciscoand/or its affiliates. All rights reserved. Cisco Confidential Enhance the user experience in Meeetings Rooms • People Count • Administration APIs • Custom UI controls for IoT Sandboxes at Cisco DevNet Webex RoomKit
  • 7.
    © 2018 Ciscoand/or its affiliates. All rights reserved. Cisco Confidential In-Room Controls Simulator https://controls-editor.herokuapp.com/playground.html?virtualroom End-to-end enriched User Experience for Meeting Rooms • In-Room Control • Node.js jsxapi
  • 8.
    © 2018 Ciscoand/or its affiliates. All rights reserved. Cisco Confidential
  • 9.
    © 2018 Ciscoand/or its affiliates. All rights reserved. Cisco Confidential Prototype with the RoomKit Sandboxes
  • 10.
    © 2018 Ciscoand/or its affiliates. All rights reserved. Cisco Confidential Coding for Serverless Platforms
  • 11.
    © 2018 Ciscoand/or its affiliates. All rights reserved. Cisco Confidential Coding for Serverless Platforms
  • 12.
    © 2018 Ciscoand/or its affiliates. All rights reserved. Cisco Confidential • Cisco Tropo is « telephony platform as a service » • In-bound / out-bound Calls and SMS • REST API endpoint • Runs 5 languages as Serverless (JS, Python, Java, Groovy, PHP) • Feedback from one year of evangelism • hackathons, meetups, tutorials • great platform • bad debugging experience An Emulator for Tropo Serverless Platform
  • 13.
    © 2018 Ciscoand/or its affiliates. All rights reserved. Cisco Confidential IVR script sample: auto-attendant
  • 14.
    © 2018 Ciscoand/or its affiliates. All rights reserved. Cisco Confidential Running Tropo Script locally
  • 15.
    © 2018 Ciscoand/or its affiliates. All rights reserved. Cisco Confidential • « Think big, Start small » • Start from use cases • « check scripts won’t break » • « debug locally » • Prototype / Evaluate / Arbitrate • A Javascript emulator that mimics the platform • 2 days to prototype during a DevNet Hack-a-tone • 5 days to beta running all scripts (17 commits total) • https://github.com/ObjectIsAdvantag/tropo-emulator-js Lessons learnt building the Tropo Emulator
  • 16.
    © 2018 Ciscoand/or its affiliates. All rights reserved. Cisco Confidential Taking emulators to the next stage https://github.com/ObjectIsAdvantag/tropo-ready-vscode
  • 19.
    © 2018 Ciscoand/or its affiliates. All rights reserved. Cisco Confidential • Providing an emulator opens a world of possibilities • Better if opensource • Visual Studio extension • Live running by exposing local scripts to Tropo cloud • 5 days, started with a Hack-a-tone again • https://github.com/ObjectIsAdvantag/tropo-ready-vscode Lessons learnt
  • 20.
    © 2018 Ciscoand/or its affiliates. All rights reserved. Cisco Confidential • A twin of your API • Fully operational • Generally NOT fully-featured • Implementing one or several use cases • Built to help your API consumers tests & debug What’s an API emulator
  • 21.
    © 2018 Ciscoand/or its affiliates. All rights reserved. Cisco Confidential ‘Your App’ now with Cisco Cloud Collab! Webex Teams APIs extend Cisco Cloud Collaboration GET POST DELETE PUT /Rooms /Memberships /Messages /Teams /People /Webhooks
  • 23.
    © 2018 Ciscoand/or its affiliates. All rights reserved. Cisco Confidential Webex API Emulator https://github.com/ObjectIsAdvantag/webex-api-emulator
  • 24.
    © 2018 Ciscoand/or its affiliates. All rights reserved. Cisco Confidential
  • 25.
    © 2018 Ciscoand/or its affiliates. All rights reserved. Cisco Confidential Meet the Webex API Emulator
  • 26.
    © 2018 Ciscoand/or its affiliates. All rights reserved. Cisco Confidential Webex Teams Bot Architecture  Register webhook events • Messages / created  Memberships / created  As events happen in spaces, receive notifications from Webex  Security tips  Select spaces to fire from via a webhook filter  Check on user’s email domain in your code  Check webhook payload signature via a shared secret Webex cloud platform 1. interacts in spaces via a Teams client Webex Teams User Your bot code running on-premises or on in the cloud 2. posts notifications to registered Webhooks 3. posts back messages as notifications fly in Publicly accessible bot endpoint
  • 27.
    © 2018 Ciscoand/or its affiliates. All rights reserved. Cisco Confidential 1. Testing (devops) 2. QA (non-regression, versioning) 3. Experimentating (API design, vNext) 4. Backup (training in restricted environments) Uses cases for API Emulators
  • 28.
    © 2018 Ciscoand/or its affiliates. All rights reserved. Cisco Confidential • Scope • Think big, Start small • Document the use cases you want to cover • Design your emulator • Keep it light (in-memory persistance) • Hyper quick to implement: couple of days • Build • Pick a raw HTTP framework to have maximum flexibility to mimic your payloads Lessons learnt
  • 29.
    © 2018 Ciscoand/or its affiliates. All rights reserved. Cisco Confidential • Are there alternatives? - API Emulator vs Mocking - API Emulator vs Service Virtualization • How to compare ? - Start from your use cases! Thoughs
  • 30.
    © 2018 Ciscoand/or its affiliates. All rights reserved. Cisco Confidential • Who are the customers of your API emulator? - your developer community - Internally (Product Management) Thoughts
  • 31.
    © 2018 Ciscoand/or its affiliates. All rights reserved. Cisco Confidential • Seriously consider adding Emulator(s) to your API Product • Narrow the use cases your emulator will cover • Build it in hours/days, not weeks/months • Opensource it: building block for other use cases & tools • Observe how your developer community leverages it • Add a disclaimer (best-effort) Wrapup
  • 32.
    © 2018 Ciscoand/or its affiliates. All rights reserved. Cisco Confidential • Webex Emulator • https://github.com/ObjectIsAdvantag/webex-api-emulator • Tropo Emulator • https://github.com/ObjectIsAdvantag/tropo-emulator-js • Tropo-Ready plugin for Visual Studio code • https://github.com/ObjectIsAdvantag/tropo-ready-vscode • DevNet Code Exchange • https://developer.cisco.com/codeexchange/ Resources
  • 33.
    © 2018 Ciscoand/or its affiliates. All rights reserved. Cisco Confidential • 500K+ members • Dev Centers, Labs, Sandboxes • Tutos Join DevNet twitter: @CiscoDevNet webex: stsfartz@cisco.com twitter: @SteveSfartz github: @ObjectIsAdvantag
  • 34.
    © 2018 Ciscoand/or its affiliates. All rights reserved. Cisco Confidential Thank you