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
310
Growing with communities
asldevi
0
92
Observability at scale
asldevi
0
210
We shall overcome - gender gap in tech
asldevi
1
470
How to kickstart your (technical) career
asldevi
0
80
Testing micro-services made easy @ PyCon 2018
asldevi
1
440
Growing with ElasticSearch
asldevi
0
110
Web development - Code to Deployment
asldevi
1
710
Other Decks in Technology
See All in Technology
C#コードの結合を可視化する Roslyn解析による設計改善と リファクタリング判断
dora56
0
960
特殊変数大全
dak2
0
170
CI/CDではもう遅い - 人とAIが迂回しないDevSecOps Verify基盤の再設計 -
kintotechdev
1
400
Oracle Cloud Infrastructure(OCI):Onboarding Session(はじめてのOCI/Oracle Supportご利⽤ガイド)
oracle4engineer
PRO
3
21k
Swap and Memory Reclaim - Squeezing Out More RAM
ennael
PRO
1
740
IR Today: Theory, Practice, and Agents
dtunkelang
0
230
AWS FinOps Agent 結局何が得意なの?
siromi
0
220
キャリアLT今日までそして明日から
kentapapa
1
110
AWS DevOps Agent スキルをつかいこなそう / Master AWS DevOps Agent Skills
kinunori
2
620
[Kiro Meetup #7] Kiro Crew Dive Deep
konippi
0
410
Datadog で始める トークンセーフティなAI 導⼊と定着
vkbaba
1
130
ボードゲームの遊び相手をFoundation Modelsで作る / iOSDC Japan 2026
genda
0
220
Featured
See All Featured
HTML-Aware ERB: The Path to Reactive Rendering @ RubyCon 2026, Rimini, Italy
marcoroth
5
750
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
340
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.6k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k
A Tale of Four Properties
chriscoyier
163
24k
Heart Work Chapter 1 - Part 1
lfama
PRO
10
36k
Leveraging LLMs for student feedback in introductory data science courses - posit::conf(2025)
minecr
1
410
DBのスキルで生き残る技術 - AI時代におけるテーブル設計の勘所
soudai
PRO
68
58k
WCS-LA-2024
lcolladotor
0
840
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
28
3.7k
Discover your Explorer Soul
emna__ayadi
2
1.3k
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
380
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