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
ReST APIs @ PyCon India, 2015
Search
Devi
October 03, 2015
Technology
620
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
ReST APIs @ PyCon India, 2015
Devi
October 03, 2015
More Decks by Devi
See All by Devi
Understanding ElasticSearch
asldevi
0
120
Logging the right way!
asldevi
2
320
Growing with communities
asldevi
0
96
Observability at scale
asldevi
0
210
We shall overcome - gender gap in tech
asldevi
1
470
How to kickstart your (technical) career
asldevi
0
81
Testing micro-services made easy @ PyCon 2018
asldevi
1
450
Growing with ElasticSearch
asldevi
0
120
Web development - Code to Deployment
asldevi
1
710
Other Decks in Technology
See All in Technology
今から始めるAWS環境の暗号移行 - ポスト量子時代に備える
sato4mi
0
130
AIコーディングエージェント開発_全体像
happysamurai294
0
140
Flutter Widget Previewerで始めるUIプレビューとVRTの自動化
sakusaku3939
0
180
Vibe-to-Spec開発_実践ガイド
happysamurai294
0
130
クラウドエージェントの先駆け Devin。今も最先端を走る、他との違い
kinopeee
1
520
AX時代の自治体支援リソース再配分と役割分担の再構成:戦略とロードマップ(概要)
sishi2026
0
140
データマネジメント × 法務で作りあげる、 freeeの新しいデータガバナンスへの軌跡
freee
PRO
2
590
1週間、Opus封印でお願いします
kintotechdev
0
400
200人の配信コメント、 全部Jevが仕分けます 〜 マサカリガードを作ってみた 〜
katayamatg
1
470
re:Inventで、人生は変わったのか? / growth-builders-hub-1-reinvent-2026
mhrtech
2
170
AIがGISを代替する日:〜すべてをAIが創る時代に、私たちがFOSS4Gに関わる意味〜
lehupa
0
140
AI AgentによるEmbedded SREの取り組み
tgidgd
1
300
Featured
See All Featured
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4.6k
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
500
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
1
590
Discover your Explorer Soul
emna__ayadi
2
1.3k
YesSQL, Process and Tooling at Scale
rocio
174
15k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
10
1.4k
Design of three-dimensional binary manipulators for pick-and-place task avoiding obstacles (IECON2024)
konakalab
0
640
The SEO Collaboration Effect
kristinabergwall1
1
610
End of SEO as We Know It (SMX Advanced Version)
ipullrank
3
4.5k
How to Talk to Developers About Accessibility
jct
2
600
Evolving SEO for Evolving Search Engines
ryanjones
0
340
We Have a Design System, Now What?
morganepeng
55
8.4k
Transcript
ReST APIs What, Why and How? A. S. L. Devi
PyCon India, 2015
What is an API programmable interface (to web services) Specifies
the request and response formats for the communication between a client and a server.
Why? • Public APIs - services through API - glues
best of several languages / technologies - AWS, Stripe, ElasticSearch, Twitter, GrapheneDB etc • Private APIs - same service offered in different UIs - a mobile app, a web app, desktop app - Slack, FaceBook etc
• Resources • URLs (Uniform Resource Locators) • HTTP -
methods and response codes ReST - Representational State Transfer
Each resource is identified by a URL. /customers /customers/5 /customers/5/orders
/customers/5/orders/42 /customers/5/orders?completed=true /customers/5/orders?completed=true&page=1 ReST - Resources
ReST - HTTP Verbs • GET - Retrieve a resource
• POST - Create a resource • PUT - Create/update a resource • DELETE - Delete a resource GET, PUT and DELETE are idempotent.
• simple • consistent across - one way of doing
things • backward compatible • HATEOS - linked documents • Well documented :) How should a ReST API be?
* taken from “Building Web APIs with Flask” with thanks
to Miguel Grinberg
$ curl -XGET http://api.x.com/v1/customers HTTP/1.1 200 OK Content-Type: application/json {
"customers": [] } $ curl -XGET http://api.x.com/v1/customers/1 { “name”: “Alice”, “links”: { “orders”: http://api.x.com/customers/1/orders “self”: http://api.x.com/customers/1 }} CRUD: Create Read Update Delete $ curl -XPOST http://api.x.com/v1/customers - d “name=Alice” HTTP/1.1 201 CREATED Content-Type: application/json Location: http://api.x.com/ customers/1 {} $ curl -XPUT http://api.x.com/v1/customers/1 -d “name=Bob” HTTP/1.1 200 OK $ http DELETE http://api.x.com/customers/1 HTTP/1.1 204 No Content
HATEOS - Linked documents $ curl -XGET http://api.x.com/v1/customers/1 { “name”:
“Alice”, “links”: { “self”: “http://api.x.com/v1/customers/1, “orders”: “http://api.x.com/v1/customers/1/orders”, } }
More HATEOS $ curl -XGET http://api.x.com/v1/customers/1/orders/10 { “links”: { “self”:
“http://api.x.com/v1/orders/10”, “customer”: “http://api.x.com/v1/customers/1” }, “orders”: [{ “date”: 2015-01-01-00:00:09Z, “items”: [ {“quantity”: 2, “product”: “XXX-1”}, {“quantity”: 3, “product”: “XYY-42”}, ] ]} }
How to choose a library to build ReST API •
Data validation • Authentication & Authorization • Not tightly coupled with ORM or database • Pagination, rate limits, filters etc.
Authentication & Authorization - no assumptions of the client side
- global authentication - Authorization header - Basic Authentication - Token-Based - HMAC based
• http://restful-api-design.readthedocs.org/en/latest/ • http://restcookbook.com/ • http://player.oreilly.com/videos/9781491911938 • http://jsonapi.org References
Questions
Thank You ! @asldevi