Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Better API DX with a CLI - APIdays Jakarta

8ec1383b240b5ba15ffb9743fceb3c0e?s=47 Phil Nash
February 24, 2021

Better API DX with a CLI - APIdays Jakarta

When you try to improve the experience for using your API you might consider a command line interface. CLIs allow developers to explore the API, automate API usage, and most importantly never leave the keyboard. If you have an OpenAPI spec you can even generate a CLI automatically. But replicating the API for the command line is the baseline, CLIs have so much more potential.

In this talk we'll discuss how Twilio built a CLI for our API and the opportunities it gave us to improve the developer experience of working with the API. With the Twilio CLI we enhanced API endpoints with extra features, helped to demystify webhooks, and let the community create their own plugins to supercharge their experience.

When done right, an API and a CLI are worth more than the sum of their parts.

---

Links:

Twilio CLI: https://twil.io/cli
Twilio CLI Source: https://github.com/twilio/twilio-cli
Twilio CLI features you should know about: https://www.twilio.com/blog/five-twilio-cli-features-you-should-know-about

8ec1383b240b5ba15ffb9743fceb3c0e?s=128

Phil Nash

February 24, 2021
Tweet

Transcript

  1. Better API DX with a CLI @philnash

  2. Phil Nash @philnash https://philna.sh philnash@twilio.com

  3. Better API DX with a CLI @philnash

  4. Better API DX with a CLI Application Programming Interface Developer

    eXperience Command Line Interface @philnash
  5. Developer experience @philnash

  6. We built a CLI @philnash

  7. $ twilio @philnash

  8. We built a CLI Node.js oclif npm & brew @philnash

  9. Know your audience Not everyone will want to use a

    CLI Hypothesis: developers prefer the command line to the console Hypothesis: developers would like to automate Twilio actions @philnash
  10. Not all CLIs are created equal @philnash

  11. Building a CLI for an API - 3 questions What's

    the minimum a CLI can do to be useful? What can you add to a CLI to make it a better experience? What can your users add to the CLI? @philnash
  12. Minimum Viable CLI @philnash

  13. Minimum Viable CLI Commands for your API endpoints Documentation You

    probably want to generate these commands @philnash
  14. Minimum Viable CLI Commands for your API endpoints Documentation Secure

    credential storage @philnash
  15. Better built in experience @philnash

  16. Better built in experience $ twilio api $ twilio --help

    @philnash
  17. Better built in experience Autocomplete Shortcuts Extra APIs Feedback Extra

    capabilities for specific APIs @philnash
  18. Who else can contribute to the experience? @philnash

  19. $ twilio plugins @philnash

  20. Building a CLI for an API - 3 questions What's

    the minimum a CLI can do to be useful? What can you add to a CLI to make it a better experience? What can your users add to the CLI? @philnash
  21. Links https://github.com/twilio/twilio-cli https://www.twilio.com/blog/five-twilio-cli-features-you-should-know-about @philnash

  22. Build great CLIs! @philnash

  23. Thanks! @philnash https://philna.sh philnash@twilio.com