Coder Dojo – RESTful API Design



Coder Dojo – RESTful API Design

0 0


rest-guidelines-pres

Zalando RESTful API guidelines presentation

On Github holger-s / rest-guidelines-pres

Coder Dojo

RESTful API Design

slides by Holger Schmeisky / @hschmeisky

API First

Design your API before you implement it in production Maybe even write a prototype to test major use cases Just like we do right now with the platform rebuild

Think of resources

REST APIs are modeled around HTTP Verbs (which are fixed) And you define the resources Resources are mostly collections For example if we want to get the orders of johndoe And if we want to add an item ...
GET /accounts/johndoe
POST /accounts/johndoe/orders

To boldly noun where no verb is allowed

How would you model transferring money from one bank account to another? Keeping the RESTful paradigm sometimes is weird, but adds consistency
POST /bank-accounts/johndoe/transactions

Styling Conventions

  • use Swagger for API documentation
  • HTTP Headers Hyphenated-Pascal-Case
  • Query parameters & JSON fields snake_case
Coder Dojo RESTful API Design slides by Holger Schmeisky / @hschmeisky