6 ways to an awesome api

@AnnaGerber

Senior Backend Developer @ PCCW Global

Develop the contract first

1

API

application programming Interface

Specification

  • Swagger (Open API)
  • API Blueprint
  • RESTful API modelling language (RAML)
  • JSON schema
  • WSDL / WADL

documentation

  • include runnable code examples
  • easy to search and navigate
  • up to date
  • versioned

Practise test-driven development (TDD)

2

TDD process

  1. think
  2. write tests
  3. write minimal code to make the tests pass
  4. refactor the code

Don't forget to refactor The TESTS too!

Prioritize the Developer Experience

3

Empathetic

API Design

  • Model-based
  • Appropriate level of abstraction and granularity
  • Flexible
  • Stable
  • Scalable

CULTIVATE CONSISTENCY

4

consistenT design

  • Naming conventions
  • Hierarchy
  • Responses
  • Error handling
  • Versioning

consistent code

  • Naming conventions
  • Consistent style
  • ES6
  • Consistent approach to async
  • Logging

consistent Environment

  • Docker
  • Env vars
  • Scripts

WORK SMARTER NOT HARDER

5

code generation

Automation

Know your tools

self development

6

code criticism

 (judging the merits and faults)

experiment

community

6 ways to an awesome API

  • Develop the contract first
  • Practise test-driven development
  • Prioritize the Developer Experience
  • Cultivate consistency
  • Work smarter not harder
  • Self development

6 ways to an awesome API

By Anna Gerber

6 ways to an awesome API

Strategies for upping your API dev game

  • 1,368