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
API Design
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
azisaka
March 04, 2013
Technology
190
7
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
API Design
A keynote made for Papaya Ventures explaining the main points when developing an API.
azisaka
March 04, 2013
More Decks by azisaka
See All by azisaka
SASS for fun and profit
azisaka
3
150
Omniauth - Basic and principles
azisaka
1
84
Other Decks in Technology
See All in Technology
強化学習「理論」入門
enakai00
3
3.6k
20260807_第6回_関東kaggler会LT_claw系bot xangiと始める、"寂しくない" kaggle
sugupoko
0
270
え?フロントエンドエンジニアの ワイがインフラも!?
puku0x
1
570
DatadogのBits Chatが開発組織にもたらしたもの / What Bits Chat Has Brought Us
sms_tech
1
260
20260804_Q4AzureUpdateBite_FabricDataAgentの精度を高める設計.pdf
matayuuu
1
130
同じWAFが、攻撃の“形”は弾く── 正当な“形”の不正は通す
kuroneko13
0
200
20分でわかるセキュアAPI
nwiizo
2
270
FORENSIA: ローカルLLMフォレンジックハーネス
sumeshi
2
390
つくって納得、つかって実感! 大規模言語モデルことはじめ ver2.0
recruitengineers
PRO
4
1.6k
関東Kaggler会発表資料
takoi
1
230
Genie Codeハンズオン基礎編
taka_aki
1
120
Agent 時代の Kaggle 展望 / kaggle-in-the-agentic-era
upura
1
720
Featured
See All Featured
It's Worth the Effort
3n
188
29k
Testing 201, or: Great Expectations
jmmastey
46
8.2k
The SEO identity crisis: Don't let AI make you average
varn
0
530
A Soul's Torment
seathinner
6
3.4k
Designing for Performance
lara
611
70k
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
66
57k
Building a Modern Day E-commerce SEO Strategy
aleyda
45
9.2k
The Cult of Friendly URLs
andyhume
79
7k
The Limits of Empathy - UXLibs8
cassininazir
1
600
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
490
WCS-LA-2024
lcolladotor
0
790
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
Transcript
por que você deveria se importar? API design
Como enviar dados para a nuvem?
API Application Programming Interface Fácil de usar Rápida Leve JSON
Construindo uma API
Representational State Transfer REST
Arquitetura DISTRIBUÍDA
Representação de Entidades /posts/1.json /posts/1/comments.json /posts/1/likes.json
HTTP METHOD ACTION VERBO SUBSTANTIVO GET DELETE POST PUT /posts
/posts /posts/1 /posts/1
USE Substantivos ao inves de verbos
verbos criam uma API prolixa GET /listarPosts.json POST /criarPost.json GET
/visualizarPost.json?id=1
Se aproveite dos HTTP methods GET /posts.json POST /posts.json GET
/posts/1.json PUT /posts/1.json DELETE /posts/1.json
Sempre plural, nunca singular
ENdpoints no plural são intuitivos GET /posts GET /posts/1 PUT
/posts/1 POST /posts
Substantivos concretos, nunca abstratos
Endpoints devem ter significado GET /items GET /products GET /users
GET /assets Ruim Bom
RELACIONE RECURSOS DE FORMA SIMPLES
Endpoints auto-explicativos Foto Likes POST /photos/1/likes Categoria Estabelecimentos GET /categories/restaurant/venues
Coloque a complexidade DEPOIS da “?”
filtros e buscas GET /posts?status=draft GET /posts/1/comments?user_id=1 GET /posts?q=something
Resultados devem ser paginados
Indiquem onde o resultado está GET /posts { “posts”: [
{ “id”: 1, title: “Post #1” }, { “id”: 2, title: “Post #2” } ], “page”: 1, “total”: 10, “perPage”: 2 } GET /posts?page=2&perPage=1 { “posts”: [ { “id”: 3, title: “Post #3” }, ], “page”: 2, “total”: 10, “perPage”: 1 }
Retorne dados parcialmente
Reduza o payload GET /posts/1 { “post”: { “id”: 1,
“title”: “Post #1”, “body”: “Post’s body”, “tags”: [“api”, “web”, “http”], “category”: { “name”: “Development” } } } GET /posts/1?fields=id,title { “post”: { “id”: 1, “title”: “Post #1” } }
Retorne erros com significado
Seja claro! POST /posts { “status”: 400, “message”: “O título
não pode ficar em branco” }
Versione sua API
E mantenha ao menos 1 versão GET /v1/posts/1 GET /v2/posts/1
{ “post”: { “id”: 1, “title”: “Post #1”, “content”: “Post’s body” } } } { “post”: { “id”: 1, “title”: “Post #1”, “body”: “Post’s body” } } }
Use um subdomínio
api.seuprojeto.com Escalabilidade independente Controle de cache e CDN independente Organização
Wrap up
APIs podem fazer a diferença durante o desenvolvimento Cuidado com
o Design
A mesma API pode ser core de aplicativos iPhone, Android,
Web e Desktop Colha os frutos
Outros aplicativos podem aumentar o valor do seu produto expandindo
o seu uso Aumente seu evaluation
O caso “Instragram”
None
None
None
None
None
Obrigado :)