Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Speaker Deck
PRO
Sign in
Sign up
for free
Battle tested API design - Laracon EU Online
Johannes Pichler
May 20, 2020
Programming
0
34
Battle tested API design - Laracon EU Online
Johannes Pichler
May 20, 2020
Tweet
Share
More Decks by Johannes Pichler
See All by Johannes Pichler
fetzi
0
50
fetzi
0
16
fetzi
0
160
fetzi
0
94
fetzi
1
34
fetzi
0
40
fetzi
3
54
fetzi
0
160
Other Decks in Programming
See All in Programming
maito1201
0
170
pirosikick
4
960
temoki
2
220
kosugitti
1
320
williln
0
230
ybrliiu
0
100
heistak
2
130
hanasuke
1
650
rarous
0
170
voyage_tech
0
130
sansuke05
1
140
joergneumann
0
130
Featured
See All Featured
chriscoyier
779
240k
bkeepers
52
4.2k
caitiem20
308
17k
roundedbygravity
84
7.9k
denniskardys
219
120k
reverentgeek
167
7.3k
ammeep
656
54k
vanstee
117
4.9k
sstephenson
145
12k
danielanewman
1
520
bryan
31
3.4k
mojombo
359
62k
Transcript
Ba#le tested API design Laracon EU Online 2020
Johannes Pichler • Web Developer since 2006 • PHP, .NET,
Java • working @ karriere.at
Agenda • API design • Implemen/ng an API in Laravel
None
API Design
Steps for building your API Design • Requirements & Planning
• Implementa4on • Verifica4on & Maintenance
Requirements & Planning
Consider the client(s)
Rou$ng • based on resources • use standard HTTP methods
• be as explicit as possible
Rou$ng GET: /todos GET: /todos/{id} POST: /todos PUT: /todos/{id} DELETE:
/todos/{id}
Rou$ng - API Versioning • frequency of endpoint changes •
handling of breaking changes • use seman8c versioning • use only major version in URLs
Response format • no custom response format • use a
defined standard • JSON:API • HAL
Authoriza*on • use specific client tokens • add access tokens
for sensi3ve endpoints
API Specifica,on • use an API client like Stoplight Studio
or Postman • define your endpoints with edge cases • make your specifica;on testable
Implemen'ng an API in Laravel
Verifica(on & Maintenance
Verifica(on • it's all about metrics • have useful error
logging in place • verify your assump7ons during development
Maintenance • be careful with breaking changes • s3ck to
seman3c versioning • keep your API specifica3on up to date
Summary
Resources • h#ps:/ /github.com/fetzi/laracon-api-design • h#ps:/ /jsonapi.org/
THANKS @fetzi_io