Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Operational API Design Anti-Patterns
Search
Jason Harmon
October 26, 2016
Technology
0
210
Operational API Design Anti-Patterns
Talk from Nordic APIs Platform Summit in Stockholm, Oct 2016
Jason Harmon
October 26, 2016
Tweet
Share
More Decks by Jason Harmon
See All by Jason Harmon
Pragmatists Guide to Hypermedia
jharmn
0
94
Other Decks in Technology
See All in Technology
ハードウェアとソフトウェアをつなぐ全てを内製している企業の E2E テストの作り方 / How to create E2E tests for a company that builds everything connecting hardware and software in-house
bitkey
PRO
1
130
複数サービスを支えるマルチテナント型Batch MLプラットフォーム
lycorptech_jp
PRO
0
330
下手な強制、ダメ!絶対! 「ガードレール」を「檻」にさせない"ガバナンス"の取り方とは?
tsukaman
2
440
RSCの時代にReactとフレームワークの境界を探る
uhyo
10
3.4k
品質視点から考える組織デザイン/Organizational Design from Quality
mii3king
0
200
AIエージェント開発用SDKとローカルLLMをLINE Botと組み合わせてみた / LINEを使ったLT大会 #14
you
PRO
0
110
Practical Agentic AI in Software Engineering
uzyn
0
110
Rustから学ぶ 非同期処理の仕組み
skanehira
1
130
2025年になってもまだMySQLが好き
yoku0825
8
4.7k
スマートファクトリーの第一歩 〜AWSマネージドサービスで 実現する予知保全と生成AI活用まで
ganota
2
210
DevIO2025_継続的なサービス開発のための技術的意思決定のポイント / how-to-tech-decision-makaing-devio2025
nologyance
1
390
[ JAWS-UG 東京 CommunityBuilders Night #2 ]SlackとAmazon Q Developerで 運用効率化を模索する
sh_fk2
3
400
Featured
See All Featured
Designing for Performance
lara
610
69k
The Art of Programming - Codeland 2020
erikaheidi
56
13k
Into the Great Unknown - MozCon
thekraken
40
2k
Art, The Web, and Tiny UX
lynnandtonic
303
21k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
Reflections from 52 weeks, 52 projects
jeffersonlam
352
21k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
26
3k
Typedesign – Prime Four
hannesfritz
42
2.8k
The World Runs on Bad Software
bkeepers
PRO
70
11k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
50k
Product Roadmaps are Hard
iamctodd
PRO
54
11k
Automating Front-end Workflow
addyosmani
1370
200k
Transcript
Operational API Design Anti-Patterns Jason Harmon @jharmn @typeform
Head of APIs @Typeform • Leading microservice replatform • Leading
developer focused initiatives Previous API experience: • PayPal/Braintree • uShip • Wayport / AT&T Jason Harmon • Old blogs at: ◦ APIUX.com ◦ Pragmaticapi.com
“API Design Anti-Patterns” talk from last year • https://www.youtube.com/watch?v=lotdj-ry8YA Design
issues don’t always cause operational issues. Haven’t we already talked about this?
Usability issues Operational issues
HTTP GET instead of POST
Landing GET /landing 200 OK { “Token”: “abc123” } User
Human
A Form User Human
Submit User Human
Submit User Human Click “Back” ? Submit needs to have
a landing (to derive “response rate”) POST /submissions (+landing_id in body)
Issue: GET Caches + HTTP GET GET /landing Caching Proxy
Or CDN Cached response X 200 OK { “Token”: “abc123” }
Landings: Better User Human POST /landing 200 OK { “Token”:
“abc123” }
• Identification: Unexpected cached API calls from browser/proxy/etc • Solution:
Use POST • Live already? ◦ Just add POST ◦ Add ?cache_buster=[random] to GET Summary: GET instead of POST
Polling APIs
Polling APIs Problem Identification: • Large dataset • Expensive queries
• Frequently changing data • Lots of clients Client app Every 5 mins Thousands of forms
Solution: Webhooks Client app Register URL New data = POST
Still needed for missing data
WHAT IF THIS IS ALREADY HAPPENING!!?! Client app Options: •
Launch webhooks! • Caching (if possible) • Read-only DB replica • Cheaper query to check for new data before retrieval
Rigid Hierarchy
Microservices structure: Forms
Issue: Many calls Microservices
Form Structure + Backend-for-Frontend Microservices B F F AKA •
Composition • Orchestration GraphQL is another potential option
• Problem: ◦ Client performance in UX ◦ N+1 calls
(client calls for parent, then calls for related/child items) • Identification: ◦ Data lacking in main resource, usually for UX devs. • Easy to add in live scenarios Summary: Rigid resource structure
Generic Actions
AKA RPC Commonly used in controlled state transitions: POST /forms/:id/publish
{ “comment”: “It’s the right time” } What’s an “action”
Perform multiple actions with one endpoint POST /forms/:id/change-status { “action”:
“publish”, “comment”: “My favorite version of this form” } Generic “action”
Product Owner - Any performance issues? Devs
Product owner: - So how many “publish” actions happened? Devs
TO THE LOGS!
Dear Product Owner. We need to build a new metrics
system to answer that question. - Yours truly, dev team. PO
Product Owner’s reply:
Cheap visibility is a good thing
Generic Actions • Identification: ◦ POST /resource/:id/generic-name + {action: process}
• Problem: “Protocol tunneling”: ◦ Lack of traceability, more work for metrics (vs cheaper HTTP logs method) • Solution: ◦ POST /resource/:id/action-name • Already live? ◦ ?action=name in optional query parameter
API Design Takeaways
Use cases first, then design.
Design can influence performance.
Structure is good, but be prepared to blur the lines.
Design can put out fires.
Don’t forget the logs.
That’s it!