$30 off During Our Annual Pro Sale. View Details »

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 Slide

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

    View Slide

  3. Better API DX
    with a CLI
    @philnash

    View Slide

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

    View Slide

  5. Developer
    experience
    @philnash

    View Slide

  6. We built a CLI
    @philnash

    View Slide

  7. $ twilio
    @philnash

    View Slide

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

    View 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 Slide

  10. Not all CLIs are
    created equal
    @philnash

    View 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 Slide

  12. Minimum Viable
    CLI
    @philnash

    View Slide

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

    View Slide

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

    View Slide

  15. Better built in
    experience
    @philnash

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

  19. $ twilio plugins
    @philnash

    View 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 Slide

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

    View Slide

  22. Build great CLIs!
    @philnash

    View Slide

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

    View Slide