SlideShare una empresa de Scribd logo
1 de 60
API REST for beginners...
...or why I should care about building an
understandable API
POST /hello-world
Javier Lafora
(@eLafo)
A small walk through historyA small walk through history
Web of documents
Widgets
Web scraping
SOAP
Mashups
http://cartodb.github.io/lisbon-2014/#/2/24.7/-7.0/0
Internet of Things
Internet of everything
Same app on multiple devices
http://www.mediabistro.com/alltwitter/api-billionaires-club_b11424
http://www.programmableweb.com/news/9000-apis-mobile-gets-serious/2013/04/30
http://apiux.com/2013/05/29/api-hierarchy-needs/
https://www.lordabbett.com/content/lordabbett/en/perspectives/equityperspectives/finding-growth-
http://www.zdnet.com/internet-of-things-8-9-trillion-market-in-2020-212-billion-connected-things-7000021516/
Dissecting an HTTP Request
● Method
● Path
● Header
● Body
Methods
GET: Requests a representation of the specified resource
POST: Requests that the server accept the entity enclosed in the request as a new
subordinate of the web resource identified by the URI
PUT: Requests that the enclosed entity be stored under the supplied URI
PATCH: Apply partial modifications to a resource
DELETE: Deletes the specified resource
HEAD: Asks for the response identical to the one that would correspond to a GET
request, but without the response body
OPTIONS: Returns the HTTP methods that the server supports for the specified URL
GET request
POST request
Dissecting an HTTP response
● Status
● Header
● Body
HTTP response
http://www.slideshare.net/supercoco9/what-is-rest-why-is-it-part-of-the-rails-way-railsconf-2014-jav
Defining an API
What to do...
...with what?
RPC
What to do?
In the body
With what?
In the body
POST /rpc HTTP/1.1
Host: www.upcdatabase.com
User-Agent: XMLRPC::Client (Ruby
1.8.4)
Content-Type: text/xml; charset=utf-8
Content-Length: 158
Connection: keep-alive
<?xml version="1.0" ?>
<methodCall>
<methodName>lookupUPC</methodNa
me>
...
</methodCall>
REST
What to do?
In the HTTP method
With what?
In the path
GET /hello.txt HTTP/1.1
Host: www.example.com
REST-RPC Hybrid
What to do?
In the path
With what?
In the path
GET services/rest?api_key=xxx&method=flickr.photos.search&tags=penguin
HTTP/1.1
Host: www.flickr.com
REST
(Representational
State Transfer)
Roy Fielding
(2000)
Architecture for
the web
Resources
resources
are not
models
Uniform and constrained interface
http://www.ibm.com/developerworks/websphere/techjournal/0903_peterson/0903_peterson.html
REST Principles (some)
Addressability
Addressability
/bands/iron_maiden
/bands/the_beatles
/releases/20140529
/releases/last
Representation oriented
Statelessness
HATEOAS (Hypermedia as the
Engine of Application State)
Use methods and
response statuses well
Make your data format consistent
Versioning
https://invoicefu.com/es/developers/api_docs
https://developers.teowaki.com/api-overview
Questions?
aspgems.com
fin
Thanks

Más contenido relacionado

Similar a API REST for beginners or why you should make your API understandable

API Management: Rise of the Planet of the Apps (2016 09-26 - Porto.Data)
API Management: Rise of the Planet of the Apps (2016 09-26 - Porto.Data)API Management: Rise of the Planet of the Apps (2016 09-26 - Porto.Data)
API Management: Rise of the Planet of the Apps (2016 09-26 - Porto.Data)Sandro Pereira
 
Ultimate Guide to 30+ API Documentation Solutions
Ultimate Guide to 30+ API Documentation SolutionsUltimate Guide to 30+ API Documentation Solutions
Ultimate Guide to 30+ API Documentation SolutionsBill Doerrfeld
 
Intro to the HTML5 Application Repository Service
Intro to the HTML5 Application Repository ServiceIntro to the HTML5 Application Repository Service
Intro to the HTML5 Application Repository ServiceMarius Obert
 
HTML Hypermedia APIs and Adaptive Web Design - reject.js
HTML Hypermedia APIs and Adaptive Web Design -  reject.js HTML Hypermedia APIs and Adaptive Web Design -  reject.js
HTML Hypermedia APIs and Adaptive Web Design - reject.js Gustaf Nilsson Kotte
 
Top 7 wrong common beliefs about Enterprise API implementation
Top 7 wrong common beliefs about Enterprise API implementationTop 7 wrong common beliefs about Enterprise API implementation
Top 7 wrong common beliefs about Enterprise API implementationOCTO Technology
 
API Management Workshop (at Startupbootcamp Berlin)
API Management Workshop (at Startupbootcamp Berlin)API Management Workshop (at Startupbootcamp Berlin)
API Management Workshop (at Startupbootcamp Berlin)3scale
 
Cloud Connectivity Service
Cloud Connectivity ServiceCloud Connectivity Service
Cloud Connectivity Servicejhpark
 
RefCard API Architecture Strategy
RefCard API Architecture StrategyRefCard API Architecture Strategy
RefCard API Architecture StrategyOCTO Technology
 
web apiで遊び倒す
web apiで遊び倒すweb apiで遊び倒す
web apiで遊び倒すKeiichi Daiba
 
HTML5 & Web Platform
HTML5 & Web PlatformHTML5 & Web Platform
HTML5 & Web PlatformSwapSkills
 
Consume (UI5) Web Apps from the HTML5 Application Repository
Consume (UI5) Web Apps from the HTML5 Application RepositoryConsume (UI5) Web Apps from the HTML5 Application Repository
Consume (UI5) Web Apps from the HTML5 Application RepositoryMarius Obert
 
API, Integration, and SOA Convergence
API, Integration, and SOA ConvergenceAPI, Integration, and SOA Convergence
API, Integration, and SOA ConvergenceKasun Indrasiri
 
Web2.0 2012 - lesson 7 - technologies and mashups
Web2.0 2012 - lesson 7 - technologies and mashups Web2.0 2012 - lesson 7 - technologies and mashups
Web2.0 2012 - lesson 7 - technologies and mashups Carlo Vaccari
 
Cloudy Open Source and DevOps
Cloudy Open Source and DevOpsCloudy Open Source and DevOps
Cloudy Open Source and DevOpsMatt O'Keefe
 
Power BI for Developers @ SQLSaturday #420 (Paris)
Power BI for Developers @ SQLSaturday #420 (Paris)Power BI for Developers @ SQLSaturday #420 (Paris)
Power BI for Developers @ SQLSaturday #420 (Paris)Rui Romano
 
Web2 Expo San Francisco
Web2 Expo San FranciscoWeb2 Expo San Francisco
Web2 Expo San FranciscoJure Cuhalev
 
WSO2Con Asia 2014 - Building the API-Centric Enterprise
WSO2Con Asia 2014 - Building the API-Centric EnterpriseWSO2Con Asia 2014 - Building the API-Centric Enterprise
WSO2Con Asia 2014 - Building the API-Centric EnterpriseWSO2
 
All Things API Presentation - Gordon Weakleim [HomeAway]
All Things API Presentation - Gordon Weakleim [HomeAway]All Things API Presentation - Gordon Weakleim [HomeAway]
All Things API Presentation - Gordon Weakleim [HomeAway]Cloud Elements
 
Web3 File Storage Options
Web3 File Storage OptionsWeb3 File Storage Options
Web3 File Storage OptionsGene Leybzon
 

Similar a API REST for beginners or why you should make your API understandable (20)

API Management: Rise of the Planet of the Apps (2016 09-26 - Porto.Data)
API Management: Rise of the Planet of the Apps (2016 09-26 - Porto.Data)API Management: Rise of the Planet of the Apps (2016 09-26 - Porto.Data)
API Management: Rise of the Planet of the Apps (2016 09-26 - Porto.Data)
 
Ultimate Guide to 30+ API Documentation Solutions
Ultimate Guide to 30+ API Documentation SolutionsUltimate Guide to 30+ API Documentation Solutions
Ultimate Guide to 30+ API Documentation Solutions
 
Intro to the HTML5 Application Repository Service
Intro to the HTML5 Application Repository ServiceIntro to the HTML5 Application Repository Service
Intro to the HTML5 Application Repository Service
 
HTML Hypermedia APIs and Adaptive Web Design - reject.js
HTML Hypermedia APIs and Adaptive Web Design -  reject.js HTML Hypermedia APIs and Adaptive Web Design -  reject.js
HTML Hypermedia APIs and Adaptive Web Design - reject.js
 
Top 7 wrong common beliefs about Enterprise API implementation
Top 7 wrong common beliefs about Enterprise API implementationTop 7 wrong common beliefs about Enterprise API implementation
Top 7 wrong common beliefs about Enterprise API implementation
 
Octo API-days 2015
Octo API-days 2015Octo API-days 2015
Octo API-days 2015
 
API Management Workshop (at Startupbootcamp Berlin)
API Management Workshop (at Startupbootcamp Berlin)API Management Workshop (at Startupbootcamp Berlin)
API Management Workshop (at Startupbootcamp Berlin)
 
Cloud Connectivity Service
Cloud Connectivity ServiceCloud Connectivity Service
Cloud Connectivity Service
 
RefCard API Architecture Strategy
RefCard API Architecture StrategyRefCard API Architecture Strategy
RefCard API Architecture Strategy
 
web apiで遊び倒す
web apiで遊び倒すweb apiで遊び倒す
web apiで遊び倒す
 
HTML5 & Web Platform
HTML5 & Web PlatformHTML5 & Web Platform
HTML5 & Web Platform
 
Consume (UI5) Web Apps from the HTML5 Application Repository
Consume (UI5) Web Apps from the HTML5 Application RepositoryConsume (UI5) Web Apps from the HTML5 Application Repository
Consume (UI5) Web Apps from the HTML5 Application Repository
 
API, Integration, and SOA Convergence
API, Integration, and SOA ConvergenceAPI, Integration, and SOA Convergence
API, Integration, and SOA Convergence
 
Web2.0 2012 - lesson 7 - technologies and mashups
Web2.0 2012 - lesson 7 - technologies and mashups Web2.0 2012 - lesson 7 - technologies and mashups
Web2.0 2012 - lesson 7 - technologies and mashups
 
Cloudy Open Source and DevOps
Cloudy Open Source and DevOpsCloudy Open Source and DevOps
Cloudy Open Source and DevOps
 
Power BI for Developers @ SQLSaturday #420 (Paris)
Power BI for Developers @ SQLSaturday #420 (Paris)Power BI for Developers @ SQLSaturday #420 (Paris)
Power BI for Developers @ SQLSaturday #420 (Paris)
 
Web2 Expo San Francisco
Web2 Expo San FranciscoWeb2 Expo San Francisco
Web2 Expo San Francisco
 
WSO2Con Asia 2014 - Building the API-Centric Enterprise
WSO2Con Asia 2014 - Building the API-Centric EnterpriseWSO2Con Asia 2014 - Building the API-Centric Enterprise
WSO2Con Asia 2014 - Building the API-Centric Enterprise
 
All Things API Presentation - Gordon Weakleim [HomeAway]
All Things API Presentation - Gordon Weakleim [HomeAway]All Things API Presentation - Gordon Weakleim [HomeAway]
All Things API Presentation - Gordon Weakleim [HomeAway]
 
Web3 File Storage Options
Web3 File Storage OptionsWeb3 File Storage Options
Web3 File Storage Options
 

Más de Javier Lafora Rey

Modular development with redux
Modular development with reduxModular development with redux
Modular development with reduxJavier Lafora Rey
 
Understanding big data-drupalcamp
Understanding big data-drupalcampUnderstanding big data-drupalcamp
Understanding big data-drupalcampJavier Lafora Rey
 
Ruby object model: A matter of life and death
Ruby object model: A matter of life and deathRuby object model: A matter of life and death
Ruby object model: A matter of life and deathJavier Lafora Rey
 
ROA - Resource Oriented Architecture
ROA - Resource Oriented ArchitectureROA - Resource Oriented Architecture
ROA - Resource Oriented ArchitectureJavier Lafora Rey
 

Más de Javier Lafora Rey (8)

An introduction to Vue.js
An introduction to Vue.jsAn introduction to Vue.js
An introduction to Vue.js
 
Modular development with redux
Modular development with reduxModular development with redux
Modular development with redux
 
Understanding big data-drupalcamp
Understanding big data-drupalcampUnderstanding big data-drupalcamp
Understanding big data-drupalcamp
 
APIs para gente normal
APIs para gente normalAPIs para gente normal
APIs para gente normal
 
¿Por qué ruby on rails?
¿Por qué ruby on rails?¿Por qué ruby on rails?
¿Por qué ruby on rails?
 
Ruby object model: A matter of life and death
Ruby object model: A matter of life and deathRuby object model: A matter of life and death
Ruby object model: A matter of life and death
 
ROA - Resource Oriented Architecture
ROA - Resource Oriented ArchitectureROA - Resource Oriented Architecture
ROA - Resource Oriented Architecture
 
How to use git without rage
How to use git without rageHow to use git without rage
How to use git without rage
 

Último

The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfkalichargn70th171
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
Active Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfActive Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfCionsystems
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
Test Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendTest Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendArshad QA
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number SystemsJheuzeDellosa
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about usDynamic Netsoft
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 

Último (20)

The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Active Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfActive Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdf
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
Test Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendTest Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and Backend
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number Systems
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about us
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 

API REST for beginners or why you should make your API understandable