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

Better API DX with a CLI - APIdays Jakarta

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

Phil Nash

February 24, 2021
Tweet

More Decks by Phil Nash

Other Decks in Programming

Transcript

  1. Better API DX
    with a CLI
    @philnash

    View full-size slide

  2. Phil Nash
    @philnash
    https://philna.sh
    [email protected]

    View full-size slide

  3. Better API DX
    with a CLI
    @philnash

    View full-size slide

  4. Better API DX with a CLI
    Application Programming Interface
    Developer eXperience
    Command Line Interface
    @philnash

    View full-size slide

  5. Developer
    experience
    @philnash

    View full-size slide

  6. We built a CLI
    @philnash

    View full-size slide

  7. $ twilio
    @philnash

    View full-size slide

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

    View full-size slide

  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

    View full-size slide

  10. Not all CLIs are
    created equal
    @philnash

    View full-size slide

  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

    View full-size slide

  12. Minimum Viable
    CLI
    @philnash

    View full-size slide

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

    View full-size slide

  14. Minimum Viable CLI
    Commands for your API endpoints
    Documentation
    Secure credential storage
    @philnash

    View full-size slide

  15. Better built in
    experience
    @philnash

    View full-size slide

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

    View full-size slide

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

    View full-size slide

  18. Who else can
    contribute to the
    experience?
    @philnash

    View full-size slide

  19. $ twilio plugins
    @philnash

    View full-size slide

  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

    View full-size slide

  21. Links
    https://github.com/twilio/twilio-cli
    https://www.twilio.com/blog/five-twilio-cli-features-you-should-know-about
    @philnash

    View full-size slide

  22. Build great CLIs!
    @philnash

    View full-size slide

  23. Thanks!
    @philnash
    https://philna.sh
    [email protected]

    View full-size slide