Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Maturidade de APIs REST
Search
Brian Thomas Storti
October 17, 2014
Programming
300
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
240
Ruby object model e metaprogramação
brianstorti
5
310
Other Decks in Programming
See All in Programming
From 6 People Classroom Meetup to 100 People Regional Conference / FOSS4G Hiroshima 2026
furukawayasuto
0
130
個人開発基盤をまるごとCloudflareに引っ越して爆速で総合的体験を向上させた話
tinykitten
0
160
Omarchy Tokyo やると聞いて UMPC 買ってセットアップしてきた
mtsmfm
0
140
LoopHub - ローカルで動く GitHub で、AI と共同開発
jugyo
1
500
テストを司るデーモンに会いに行く 〜隔離した仮想マシンでテストを通すまで〜
h1d3mun3
1
160
アクセシビリティから考える情報設計
high_g_engineer
0
350
Intent as Code
shoppingjaws
6
920
WebMCP Challenge に星空観察アプリで参加した話
okajun35
0
140
Deep dive into the select statement (GopherCon UK)
jespino
0
170
世界の中心で、AI(App Intents)をさけぶ ー App Intents中心設計の実践ガイド
touyou
0
390
新卒PdEのリアル
ryu1013
1
490
まだ間に合う!今年の夏こそSchemeのマクロ展開器を完全理解!
omasanori
0
650
Featured
See All Featured
Ecommerce SEO: The Keys for Success Now & Beyond - #SERPConf2024
aleyda
1
2.1k
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
820
Writing Fast Ruby
sferik
630
63k
Documentation Writing (for coders)
carmenintech
77
5.5k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
2.1k
The browser strikes back
jonoalderson
0
1.7k
Deep Space Network (abreviated)
tonyrice
0
300
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3.7k
YesSQL, Process and Tooling at Scale
rocio
174
15k
Building Flexible Design Systems
yeseniaperezcruz
330
41k
More Than Pixels: Becoming A User Experience Designer
marktimemedia
3
520
Learning to Love Humans: Emotional Interface Design
aarron
275
41k
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