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

Battle tested API design

Battle tested API design

Well designed and performant API's are key aspects of good and reliable application systems.

Especially when kicking of an API system it is really hard to setup and define all boundaries that are necessary to build a futureproof API. Changes later on can be time consuming and of course expensive.

Therefore it is extremely important to plan the API design beforehand and to use best practices and patterns from the industry.

In this session I will guide the listeners through the creation process of an API and will introduce and explain all important parts that constitute a battle tested and robust API. Things like middleware layers, security tokens are only some key points that will be presented on stage.

Johannes Pichler

August 30, 2019
Tweet

More Decks by Johannes Pichler

Other Decks in Programming

Transcript

  1. Johannes Pichler • Web Developer since 2006 • PHP, .NET,

    Java • Lead Developer @ karriere.at
  2. Outline • API design in general • Slim framework and

    Laravel Eloquent • Exercises Middlewares • Exercises json:api responses • Exercise json:api hydrators
  3. Routing - API Versioning • frequency of endpoint changes •

    handling of breaking changes • use semantic versioning • use only major version in URLs
  4. Response format • no custom response format • use a

    defined standard •JSON:API •HAL
  5. API Specification • use an API client like Postman •

    define your endpoints with edge cases • make your specification testable
  6. Selecting a Framework • PSR-7 HTTP message interface •ServerRequestInterface •ResponseInterface

    • Middleware support (PSR-15) • dependency injection • configuration management
  7. Middlewares • used for standard API logic • can be

    used globally, per route or per route group • easy way to intercept the request lifecycle
  8. Verification • it's all about metrics • have useful error

    logging in place • verify your assumptions during development
  9. Maintenance • be careful with breaking changes • stick to

    semantic versioning • keep your API specification up to date
  10. json:api relationships { "data": { "type": "product", "id": "1", "attributes":

    { "name": "Product 1", "price": 1000 }, "relationships": { "product-group": { "data": { "type": "product-group", "id": "1" } } } } }