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
Maturidade de APIs REST
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Brian Thomas Storti
October 17, 2014
Programming
290
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Maturidade de APIs REST
Brian Thomas Storti
October 17, 2014
More Decks by Brian Thomas Storti
See All by Brian Thomas Storti
Introdução ao Ruby
brianstorti
6
230
Ruby object model e metaprogramação
brianstorti
5
310
Other Decks in Programming
See All in Programming
net-httpのHTTP/2対応について
naruse
0
490
Vite+ Unified Toolchain for the Web
naokihaba
0
310
Snowflake Summitでの新機能 CoCo / CoWork / snowflake-summit-2026-overall-what-new-coco
tatsuhiro
1
140
Mujeres en SEO Summit 2026 - Greatest Disaster Hits en Web Performance
guaca
0
180
Lemonade + Foundry Toolkit でお手軽アプリ開発
seosoft
1
340
フロントエンドとバックエンドで「1文字」を揃えよう
youkidearitai
PRO
0
690
スマートグラスで並列バイブコーディング
hyshu
0
140
TAKTでAI駆動開発の品質を設計する
j5ik2o
7
1.3k
そのテスト、説明できますか?~LWテスト戦略FW~のご紹介
nakahara
0
130
エージェンティックRAGにAWSで入門しよう!
har1101
8
1.6k
決定論的オーケストレーションの設計と実装 / Design and Implementation of Deterministic Orchestration
nrslib
4
1.4k
メソッドのジェネリクスでGoの夢は広がるか? / Kyoto.go #65
utgwkk
3
780
Featured
See All Featured
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
300
Skip the Path - Find Your Career Trail
mkilby
1
150
Build your cross-platform service in a week with App Engine
jlugia
234
18k
Designing for Performance
lara
611
70k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.8k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
2.9k
Kristin Tynski - Automating Marketing Tasks With AI
techseoconnect
PRO
0
270
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
340
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
2
400
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
65
56k
Google's AI Overviews - The New Search
badams
0
1k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
3.2k
Transcript
T h e D e v e l o p
e r s C o n f e r e n c e 2 0 1 4 MATURIDADE DE APIS REST Brian Storti Pedro Vereza
O QUE É REST ? 2
MODELO DE MATURIDADE Leonard Richardson, 2008 3
MODELO DE MATURIDADE 4
NIVEL 0 Uma URL e um método HTTP 5
NIVEL 0 ▫︎Um método HTTP ▫︎Uma URL ▫︎Tudo no payload
▫︎Independe do formato ▫︎SOAP 6 POST /tdcService HTTP/1.1 ! <openSlotRequest trilha = "arquitetura" data = "16-10-2014" duracao = "15"/> HTTP/1.1 200 OK ! <openSlotList> <slot start = "1655" end = "1710"> <trilha id = "arquitetura"/> </slot> </openSlotList>
NIVEL 1 Várias URLs e um método HTTP 7
NIVEL 1 ▫︎Um método HTTP ▫︎Várias URLs ▫︎URI Tunneling ▫︎HTTP
como camada de transporte 8 POST /getOpenSlots HTTP/1.1 ! <openSlotRequest trilha = "arquitetura" data = "16-10-2014" duracao = "15"/> POST /reserveSlot? trilha=arquitetura&date=16-10-2014 &nome=Maturidade-API-REST HTTP/1.1 HTTP/1.1 200 OK ! <openSlotResponse> <slot start = "1655" end = "1710"> <trilha id = "arquitetura"/> </slot> <openSlotResponse/>
NIVEL 2 Uso adequado do HTTP 9
NIVEL 2 ▫︎Várias URLs ▫︎Uso adequado dos métodos HTTP (RFC
2616) 10 GET /openSlots? trilha=arquitetura&data=16-10-2014 &duracao=15 HTTP/1.1 ! POST /reserveSlot? trilha=arquitetura&date=16-10-2014 &nome=Maturidade-API-REST HTTP/1.1 HTTP/1.1 200 OK <openSlotResponse> <slot start = "1655" end = "1710"> <trilha id = "arquitetura"/> </slot> <openSlotResponse/> HTTP/1.1 201 Created Location: /palestras/1234
11 NIVEL 3 Hypermedia
NIVEL 3 ▫︎Hypermedia ▫︎Hypermedia ▫︎Hypermedia 12 GET /openSlots HTTP/1.1 HTTP/1.1
200 OK <openSlotResponse> <link href="api.tdc.com/slot/1" rel = "reserve.slot" > <slot id=1 start="1655" end="1710"> <trilha id="arquitetura"/> </slot> <openSlotResponse/> GET api.tdc.com/ HTTP/1.1 200 OK <link href= "api.tdc.com/openSlots" rel= "open.slots"/> ! <link href= "api.tdc.com/slots" rel= "all.slots"/>
NETFLIX 13 <catalog_title_index> <title_index_item> <id>http://api-public.netflix.com/catalog/titles/movies/512381</id> <updated>1217404229</updated> <link href="http://api-public.netflix.com/catalog/people/20001977" rel="http://schemas.netflix.com/catalog/person.actor" title="Anna
Paquin"/> <link href="http://api-public.netflix.com/catalog/people/23599" rel="http://schemas.netflix.com/catalog/person.actor" title="Dana Delany"/> <link href="http://api-public.netflix.com/catalog/people/21741" rel="http://schemas.netflix.com/catalog/person.actor" title="Jeff Daniels"/> <release_year>1996</release_year> <link href="http://www.netflix.com/Movie/Fly_Away_Home/512381" rel="alternate" title="web page"/> <external_ids> <id rel="http://schemas.netflix.com/catalog/id.upc">0043396824393</id> <id rel="http://schemas.netflix.com/catalog/id.upc">0043396060463</id> </external_ids> </title_index_item> </catalog_title_index>
"Se o estado da aplicação não está sendo controlado por
hypermedia, então ela não pode ser chamada de RESTful. Ponto. Existe algum manual quebrado em algum lugar que precisa ser arrumado?” Roy Fielding, 2008 14
MUITO BONITO, MAS Por que não existem muitos serviços nível
3? 15
HAL+JSON 16
HAL+JSON 17
MODELO DE MATURIDADE 18 Uma URL, um método HTTP Várias
URLs, um método HTTP Uso adequado do HTTP Hypermedia
BOAS PRÁTICAS 19
CONHECERÁS TEUS VERBOS Saiba o que sua aplicação está dizendo
20
21 RFC 2616
MÉTODOS HTTP ▫︎GET - Leitura ▫︎DELETE - Remoção ▫︎POST -
Criação ▫︎PUT - Atualização 22
23 RFC 2616
"Se a URL requisitada não aponta para um recurso existente,
e esta URL pode ser definida como um novo recurso, o servidor pode criar o recurso nessa URL.” RFC 2616 sobre PUT 24
NÃO PERDERÁS TEMPO Cache 25
A requisição mais rápida é a requisição que não é
feita. 26
DIRÁS A VERDADE 27
STATUS CODE ▫︎1xx - Informação ▫︎2xx - Sucesso ▫︎3xx -
Redirecionamento ▫︎4xx - Erro do cliente ▫︎5xx - Erro do servidor 28
DIRÁS A VERDADE 29
ABRAÇARÁS A WEB 30
Brian Storti www.brianstorti.com
[email protected]
! Pedro Vereza www.pedrovereza.com
[email protected]
OBRIGADO