SlideShare una empresa de Scribd logo
1 de 141
RESTful APIs




         Promises & Lies!
Tareque	
  (täreɪk)	
  	
  
what	
  do	
  all	
  these	
  companies	
  
     have	
  in	
  common?	
  
they	
  thrive	
  in	
  their	
  business	
  
using	
  APIs	
  
in	
  fact,	
  all	
  of	
  them	
  provide	
  
RESTful	
  APIs	
  
all	
  of	
  them	
  secure	
  their	
  APIs	
  
using	
  Oauth	
  
these	
  facts	
  are	
  not	
  coincidental	
  
these	
  companies	
  made	
  a	
  
choice	
  
they	
  chose	
  to	
  do	
  their	
  APIs	
  
right	
  
so	
  what	
  is	
  this	
  talk	
  about?	
  
it’s	
  about	
  Web	
  APIs	
  
it’s	
  about	
  how	
  we	
  build	
  APIs	
  
nowadays	
  
nice	
  &	
  solid	
  
we	
  all	
  have	
  been	
  building	
  APIs	
  
for	
  some	
  time	
  now	
  
till	
  this	
  date,	
  there	
  are	
  hardly	
  any	
  
resource	
  available	
  
that	
  tell	
  you	
  how	
  to	
  build	
  APIs	
  right	
  
standards	
  
best	
  practices	
  
we	
  all	
  learn	
  them	
  hard	
  way	
  
+	
  
=	
  magical	
  API	
  
Not  really..
 but	
  you	
  can	
  make	
  APIs	
  magical	
  
ask	
  questions	
  
is	
  your	
  API	
  RESTful?	
  
.	
  stateless	
  
.	
  cacheable	
  
.	
  HTTP	
  methods	
  
	
  
take	
  action	
  depending	
  on	
  the	
  
type	
  of	
  HTTP	
  request	
  
GET	
  	
   	
     	
  -­‐	
  retrieve	
  
POST	
   	
        	
  -­‐	
  create	
  
PUT	
   	
         	
  -­‐	
  update	
  
DELETE	
           	
  -­‐	
  destroy	
  	
  
using	
  these	
  verbs	
  API	
  clients	
  act	
  
on	
  resources	
  
your	
  API	
  is	
  only	
  as	
  good	
  as	
  the	
  
resources	
  it	
  delivers	
  
are	
  your	
  resources	
  well	
  defined?	
  
say	
  you	
  have	
  a	
  django	
  project	
  
it	
  has	
  a	
  lot	
  of	
  models	
  
attractive	
  models	
  
resource	
  !=	
  model	
  
resource	
  =	
  unit	
  of	
  information	
  
that	
  you	
  own	
  
and	
  everyone	
  else	
  wants	
  a	
  piece	
  
define	
  them	
  with	
  care	
  
class	
  Book	
  (Model):	
  
     	
  title	
   	
  =	
  Charfield(...)	
  
     	
  summary 	
  =	
  Charfield(...)	
  
     	
  isbn10	
   	
  =	
  Charfield(...)	
  
     	
  isbn13	
   	
  =	
  Charfield(...) 	
  	
  
     	
  authors	
  	
  =	
  ManyToManyField(...)	
  
     	
  created	
  	
  =	
  DateTimeField(...)	
  
	
  
{	
  
        	
  ‘title’ 	
     	
  :	
  ‘...’,	
  
        	
  ‘summary’      	
  :	
  ‘...’,	
  
        	
  ‘authors’      	
  :	
  [‘...’,	
  ‘...’],	
  
        	
  ‘editions’ 	
  :	
  [{	
  
        	
     	
  ‘number’	
        	
  	
  	
  	
  :	
  ‘...’,	
  
        	
     	
  ‘publisher’ 	
  	
  	
  	
  :	
  ‘...’,	
  
        	
     	
  ‘date_published’:	
  ‘...’,	
  
        	
     	
  }],	
  
        	
  ‘is_favorite’ :	
  true,	
  
                           	
  
}	
  
class	
  Book	
  (Model):	
  
       	
  title	
  
                  	
  =	
  Charfield(...)	
  
       	
  summary             	
  =	
  Charfield(...)	
  
       	
  isbn10	
            	
  =	
  Charfield(...)	
  
       	
  isbn13	
            	
  =	
  Charfield(...) 	
  	
  
       	
  authors	
           	
  =	
  ManyToManyField(...)	
  
       	
  created	
           	
  =	
  DateTimeField(...)	
  
	
  
{	
  
        	
  ‘title’
                  	
          	
  :	
  ‘...’,	
  
        	
  ‘summary’         	
  :	
  ‘...’,	
  
        	
  ‘authors’         	
  :	
  [‘...’,	
  ‘...’],	
  
        	
  ‘editions’        	
  :	
  [{	
  
        	
        	
  ‘number’                	
        	
  	
  	
  	
  :	
  ‘...’,	
  
        	
        	
  ‘publisher’ 	
  	
  	
  	
  :	
  ‘...’,	
  
        	
        	
  ‘date_published’:	
  ‘...’,	
  
        	
        	
  }],	
  
        	
  ‘is_favorite’ 	
  :	
  true,	
  
}	
  
resource	
  !=	
  model	
  
concise	
  &	
  complete	
  	
  
but	
  are	
  resources	
  the	
  only	
  thing	
  
you	
  send	
  in	
  API	
  responses?	
  
resource	
  structures	
  vary	
  wildly	
  
API	
  responses	
  should	
  be	
  
predictable	
  
API	
  responses	
  should	
  be	
  
parsable	
  
API	
  responses	
  should	
  be	
  
uniform	
  
API
                                RESPONSE




wrap	
  them	
  in	
  envelopes	
  
add	
  metadata	
  about	
  response	
  
.	
  HTTP	
  status	
  code	
  
.	
  error	
  code	
  &	
  message	
  
.	
  pagination	
  data	
  
{	
  
        	
  ‘status’ 	
  :	
  200,	
  
        	
  ‘errors’ 	
  :	
  [],	
  
        	
  ‘data’     	
  :	
  {	
  
        	
   	
  ‘title’          	
  :	
  ‘...’,	
  
        	
   	
  ‘isbn10’ 	
  :	
  ‘...’,	
  
        	
   	
  ‘summary’ 	
  :	
  ‘...’,	
  	
  
        	
   	
  ‘authors’ 	
  :	
  [‘...’,	
  ‘...’],	
  
        	
   	
  }	
  
        	
  }	
  
{	
  
        	
  ‘status’ 	
  :	
  400,	
  
        	
  ‘errors’ 	
  :	
  [{	
  
        	
        	
  ‘code’	
   	
  :	
  5,	
  
                                 	
  
        	
        	
  ‘message’	
     	
  :	
  ‘OMG	
  form	
  errors!’,	
  
        	
        	
  ‘data’	
   	
  :	
  {	
  
                                 	
  
        	
        	
   	
  ‘title’:	
  [‘Field	
  required’],	
  
                    	
  
        	
        	
   	
  }	
  
                    	
  
        	
        	
  }],	
  
        	
  ‘data’:	
  {},	
  
                         	
  
        	
  }	
  
{	
  
    	
  ‘status’ 	
  :	
  200,	
  
    	
  ‘errors’ 	
  :	
  [],	
  
    	
  ‘data’          	
  :	
  {	
  
    	
   	
  ‘pagination’:	
  {	
  
    	
   	
   	
  ‘count’ 	
  :	
  134,	
  
              	
  
    	
   	
   	
  ‘pages’ 	
  :	
  7,	
  
              	
  
    	
   	
   	
  }	
  
              	
  
    	
   	
  ‘results’:	
  [...],	
  
    	
   	
  }	
  
    	
  }	
  
now	
  that	
  you	
  have	
  uniform	
  
responses	
  
ask	
  yourself	
  
would	
  you	
  support	
  different	
  
serialization	
  formats?	
  
the	
  world	
  is	
  moving	
  towards	
  
json	
  
it’s	
  a	
  greener	
  alternative	
  to	
  XML	
  
but	
  you	
  might	
  want	
  to	
  support	
  
jsonp	
  
or	
  XML	
  
more	
  formats	
  =	
  more	
  testing	
  
more	
  formats	
  =	
  more	
  support	
  
                        requests	
  
it’s	
  cool	
  if	
  you	
  can	
  accommodate	
  
serialization	
  parameters	
  !=	
  cool	
  
format=xml	
  
client	
  can	
  add	
  .json	
  or	
  .xml	
  at	
  
end	
  of	
  URL	
  
Now  you  
                                          see  it..	


http://api.domain.com/v1.0/books/game-­‐of-­‐thrones.xml	
  
Now  you  
                                        don’t..	


http://api.domain.com/v1.0/books/game-­‐of-­‐thrones	
  
in	
  absence	
  of	
  specified	
  format	
  
return	
  default	
  
then	
  it’s	
  all	
  good	
  
Did  you  
                                  notice  that?	


http://api.domain.com/v1.0/books/game-­‐of-­‐thrones	
  
versioning	
  your	
  API	
  is	
  cool	
  
6	
  days	
  of	
  beer	
  in	
  Portland	
  
your	
  pants	
  might	
  not	
  fit	
  
6	
  months	
  of	
  deployment	
  in	
  
production	
  
your	
  APIs	
  might	
  not	
  fit	
  
version	
  your	
  API	
  
Why  hello  
                                    there!	


http://api.domain.com/v1.0/books/game-­‐of-­‐thrones	
  
save	
  URL	
  namespace	
  
now	
  to	
  one	
  of	
  the	
  most	
  
important	
  questions..	
  
Is  the  anomaly  
 systemic,  creating  
fluctuations  in  even  
the  most  simplistic  
     equations?
always	
  hated	
  that	
  guy	
  
the	
  question	
  we	
  are	
  looking	
  for	
  
is..	
  
Is  your  API  secure?
some	
  endpoints	
  need	
  to	
  be	
  secure	
  
private	
  user	
  data	
  
resources	
  that	
  bring	
  revenue	
  
to	
  protect	
  resources,	
  use	
  an	
  
authentication	
  scheme	
  
use	
  Oauth	
  
use	
  Oauth	
  1.0	
  
use	
  Oauth	
  2.0	
  
use	
  2-­‐legged	
  Oauth	
  for	
  
applications	
  directly	
  accessing	
  
resources	
  
use	
  3-­‐legged	
  Oauth	
  for	
  
applications	
  accessing	
  resources	
  
on	
  behalf	
  of	
  users	
  
use	
  HTTPS	
  for	
  calls	
  to	
  protected	
  
resources	
  
using	
  Oauth	
  might	
  get	
  a	
  little	
  
complex	
  
how	
  to	
  minimize	
  that	
  complexity?	
  
what’s	
  the	
  easiest	
  route	
  to	
  
securing	
  your	
  API?	
  
and	
  making	
  your	
  API	
  comply	
  
with	
  the	
  concepts	
  we	
  discussed?	
  
bring	
  us	
  to	
  the	
  next	
  question..	
  
do	
  you	
  use	
  any	
  API	
  frameworks?	
  
django-­‐piston	
  
tastypie	
  
django-­‐rest-­‐framework	
  
dj-­‐webmachine	
  
take	
  your	
  pick	
  
none	
  of	
  these	
  frameworks	
  will	
  
do	
  everything	
  for	
  you	
  
make	
  them	
  work	
  for	
  you	
  
to	
  build	
  
we	
  used	
  django-­‐piston	
  
piston	
  has	
  built	
  in	
  Oauth	
  support	
  
and	
  a	
  flexible	
  architecture	
  using	
  
pluggable	
  components	
  
pluggable	
  resource	
  handlers	
  
pluggable	
  emitters	
  (serializers)	
  
pluggable	
  authentication	
  
we	
  enhanced	
  django-­‐piston	
  
.	
  pluggable	
  envelopes	
  
.	
  form	
  error	
  feedbacks	
  
.	
  anonymous	
  tokens	
  
added	
   resource	
  definition	
  
          subsystem	
  
class	
  BookDetailedView	
  (PistonView):	
  
	
  	
  	
  	
  fields	
  =	
  [	
  
             	
  ‘title’,	
  
             	
  ‘isbn10’,	
  
             	
  ‘pages’,	
  
             	
  Field(	
  
             	
        	
  ‘’,	
  
             	
        	
  lambda	
  x:	
  [y.name	
  for	
  y	
  in	
  
x.authors.all()],	
  
             	
        	
  destination=‘authors’,	
  
             	
        	
  ),	
  
             	
  ]	
  
	
  
return	
  BookDetailedView(book)	
  
{	
  
        	
  ‘title’ 	
  :	
  ‘...’,	
  
        	
  ‘isbn10’ 	
  :	
  ‘...’,	
  
        	
  ‘pages’ 	
  :	
  357,	
  	
  
        	
  ‘authors’	
  :	
  [‘...’,	
  ‘...’],	
  
}	
  
http://github.com/pbs-­‐education/django-­‐piston	
  
again,	
  you	
  have	
  quite	
  a	
  few	
  choices	
  
.	
  django-­‐piston	
  
.	
  tastypie	
  
.	
  django-­‐rest-­‐framework	
  
.	
  dj-­‐webmachine	
  
take	
  your	
  pick	
  
make	
  them	
  work	
  for	
  you	
  
build	
  your	
  API	
  right	
  
join	
  the	
  party	
  
thank	
  you	
  
tarequeh	
  
   	
  -­‐	
  slideshare.net	
  
   	
  -­‐	
  twitter	
  
   	
  -­‐	
  .com	
  

Más contenido relacionado

La actualidad más candente

Leveraging the Power of Graph Databases in PHP
Leveraging the Power of Graph Databases in PHPLeveraging the Power of Graph Databases in PHP
Leveraging the Power of Graph Databases in PHPJeremy Kendall
 
Gail villanueva add muscle to your wordpress site
Gail villanueva   add muscle to your wordpress siteGail villanueva   add muscle to your wordpress site
Gail villanueva add muscle to your wordpress sitereferences
 
Fields in Core: How to create a custom field
Fields in Core: How to create a custom fieldFields in Core: How to create a custom field
Fields in Core: How to create a custom fieldIvan Zugec
 
The Query the Whole Query and Nothing but the Query
The Query the Whole Query and Nothing but the QueryThe Query the Whole Query and Nothing but the Query
The Query the Whole Query and Nothing but the QueryChris Olbekson
 
Introduction to Moose
Introduction to MooseIntroduction to Moose
Introduction to Moosethashaa
 
Yii, frameworks and where PHP is heading to
Yii, frameworks and where PHP is heading toYii, frameworks and where PHP is heading to
Yii, frameworks and where PHP is heading toAlexander Makarov
 
Open Source Search: An Analysis
Open Source Search: An AnalysisOpen Source Search: An Analysis
Open Source Search: An AnalysisJustin Finkelstein
 
Surviving the Zombie Apocalypse using Custom Post Types and Taxonomies
Surviving the Zombie Apocalypse using Custom Post Types and TaxonomiesSurviving the Zombie Apocalypse using Custom Post Types and Taxonomies
Surviving the Zombie Apocalypse using Custom Post Types and TaxonomiesBrad Williams
 
Introduction To Moose
Introduction To MooseIntroduction To Moose
Introduction To MooseMike Whitaker
 
Moose (Perl 5)
Moose (Perl 5)Moose (Perl 5)
Moose (Perl 5)xSawyer
 
OO Perl with Moose
OO Perl with MooseOO Perl with Moose
OO Perl with MooseNelo Onyiah
 
How to use MongoDB with CakePHP
How to use MongoDB with CakePHPHow to use MongoDB with CakePHP
How to use MongoDB with CakePHPichikaway
 

La actualidad más candente (14)

Leveraging the Power of Graph Databases in PHP
Leveraging the Power of Graph Databases in PHPLeveraging the Power of Graph Databases in PHP
Leveraging the Power of Graph Databases in PHP
 
Gail villanueva add muscle to your wordpress site
Gail villanueva   add muscle to your wordpress siteGail villanueva   add muscle to your wordpress site
Gail villanueva add muscle to your wordpress site
 
Fields in Core: How to create a custom field
Fields in Core: How to create a custom fieldFields in Core: How to create a custom field
Fields in Core: How to create a custom field
 
Theme API
Theme APITheme API
Theme API
 
The Query the Whole Query and Nothing but the Query
The Query the Whole Query and Nothing but the QueryThe Query the Whole Query and Nothing but the Query
The Query the Whole Query and Nothing but the Query
 
XQuery Design Patterns
XQuery Design PatternsXQuery Design Patterns
XQuery Design Patterns
 
Introduction to Moose
Introduction to MooseIntroduction to Moose
Introduction to Moose
 
Yii, frameworks and where PHP is heading to
Yii, frameworks and where PHP is heading toYii, frameworks and where PHP is heading to
Yii, frameworks and where PHP is heading to
 
Open Source Search: An Analysis
Open Source Search: An AnalysisOpen Source Search: An Analysis
Open Source Search: An Analysis
 
Surviving the Zombie Apocalypse using Custom Post Types and Taxonomies
Surviving the Zombie Apocalypse using Custom Post Types and TaxonomiesSurviving the Zombie Apocalypse using Custom Post Types and Taxonomies
Surviving the Zombie Apocalypse using Custom Post Types and Taxonomies
 
Introduction To Moose
Introduction To MooseIntroduction To Moose
Introduction To Moose
 
Moose (Perl 5)
Moose (Perl 5)Moose (Perl 5)
Moose (Perl 5)
 
OO Perl with Moose
OO Perl with MooseOO Perl with Moose
OO Perl with Moose
 
How to use MongoDB with CakePHP
How to use MongoDB with CakePHPHow to use MongoDB with CakePHP
How to use MongoDB with CakePHP
 

Destacado

Building RESTful APIs
Building RESTful APIsBuilding RESTful APIs
Building RESTful APIsSilota Inc.
 
REST Easy with Django-Rest-Framework
REST Easy with Django-Rest-FrameworkREST Easy with Django-Rest-Framework
REST Easy with Django-Rest-FrameworkMarcel Chastain
 
Linux Composite Communication
Linux Composite CommunicationLinux Composite Communication
Linux Composite CommunicationTareque Hossain
 
Are RESTful APIs Well-designed? Detection of their Linguistic (Anti)Patterns
Are RESTful APIs Well-designed? Detection of their Linguistic (Anti)PatternsAre RESTful APIs Well-designed? Detection of their Linguistic (Anti)Patterns
Are RESTful APIs Well-designed? Detection of their Linguistic (Anti)PatternsFrancis Palma
 
API Design & Security in django
API Design & Security in djangoAPI Design & Security in django
API Design & Security in djangoTareque Hossain
 
All you need to know when designing RESTful APIs
All you need to know when designing RESTful APIsAll you need to know when designing RESTful APIs
All you need to know when designing RESTful APIsJesús Espejo
 
RESTFul API Design and Documentation - an Introduction
RESTFul API Design and Documentation - an IntroductionRESTFul API Design and Documentation - an Introduction
RESTFul API Design and Documentation - an IntroductionMiredot
 
Building Consistent RESTful APIs in a high-performance environment
Building Consistent RESTful APIs in a high-performance environmentBuilding Consistent RESTful APIs in a high-performance environment
Building Consistent RESTful APIs in a high-performance environmentLinkedIn
 
대용량 분산 아키텍쳐 설계 #1 아키텍쳐 설계 방법론
대용량 분산 아키텍쳐 설계 #1 아키텍쳐 설계 방법론대용량 분산 아키텍쳐 설계 #1 아키텍쳐 설계 방법론
대용량 분산 아키텍쳐 설계 #1 아키텍쳐 설계 방법론Terry Cho
 

Destacado (10)

Building RESTful APIs
Building RESTful APIsBuilding RESTful APIs
Building RESTful APIs
 
REST Easy with Django-Rest-Framework
REST Easy with Django-Rest-FrameworkREST Easy with Django-Rest-Framework
REST Easy with Django-Rest-Framework
 
RESTful API Design, Second Edition
RESTful API Design, Second EditionRESTful API Design, Second Edition
RESTful API Design, Second Edition
 
Linux Composite Communication
Linux Composite CommunicationLinux Composite Communication
Linux Composite Communication
 
Are RESTful APIs Well-designed? Detection of their Linguistic (Anti)Patterns
Are RESTful APIs Well-designed? Detection of their Linguistic (Anti)PatternsAre RESTful APIs Well-designed? Detection of their Linguistic (Anti)Patterns
Are RESTful APIs Well-designed? Detection of their Linguistic (Anti)Patterns
 
API Design & Security in django
API Design & Security in djangoAPI Design & Security in django
API Design & Security in django
 
All you need to know when designing RESTful APIs
All you need to know when designing RESTful APIsAll you need to know when designing RESTful APIs
All you need to know when designing RESTful APIs
 
RESTFul API Design and Documentation - an Introduction
RESTFul API Design and Documentation - an IntroductionRESTFul API Design and Documentation - an Introduction
RESTFul API Design and Documentation - an Introduction
 
Building Consistent RESTful APIs in a high-performance environment
Building Consistent RESTful APIs in a high-performance environmentBuilding Consistent RESTful APIs in a high-performance environment
Building Consistent RESTful APIs in a high-performance environment
 
대용량 분산 아키텍쳐 설계 #1 아키텍쳐 설계 방법론
대용량 분산 아키텍쳐 설계 #1 아키텍쳐 설계 방법론대용량 분산 아키텍쳐 설계 #1 아키텍쳐 설계 방법론
대용량 분산 아키텍쳐 설계 #1 아키텍쳐 설계 방법론
 

Similar a RESTful APIs: Promises & lies

Data models in Angular 1 & 2
Data models in Angular 1 & 2Data models in Angular 1 & 2
Data models in Angular 1 & 2Adam Klein
 
Single Page Web Applications with CoffeeScript, Backbone and Jasmine
Single Page Web Applications with CoffeeScript, Backbone and JasmineSingle Page Web Applications with CoffeeScript, Backbone and Jasmine
Single Page Web Applications with CoffeeScript, Backbone and JasminePaulo Ragonha
 
Seu primeiro app Android e iOS com Compose Multiplatform
Seu primeiro app Android e iOS com Compose MultiplatformSeu primeiro app Android e iOS com Compose Multiplatform
Seu primeiro app Android e iOS com Compose MultiplatformNelson Glauber Leal
 
Introduction to node.js
Introduction to node.jsIntroduction to node.js
Introduction to node.jsAdrien Guéret
 
Crossing the Bridge: Connecting Rails and your Front-end Framework
Crossing the Bridge: Connecting Rails and your Front-end FrameworkCrossing the Bridge: Connecting Rails and your Front-end Framework
Crossing the Bridge: Connecting Rails and your Front-end FrameworkDaniel Spector
 
GraphQL & Relay - 串起前後端世界的橋樑
GraphQL & Relay - 串起前後端世界的橋樑GraphQL & Relay - 串起前後端世界的橋樑
GraphQL & Relay - 串起前後端世界的橋樑Pokai Chang
 
Stop the noise! - Introduction to the JSON:API specification in Drupal
Stop the noise! - Introduction to the JSON:API specification in DrupalStop the noise! - Introduction to the JSON:API specification in Drupal
Stop the noise! - Introduction to the JSON:API specification in DrupalBjörn Brala
 
Overview of GraphQL & Clients
Overview of GraphQL & ClientsOverview of GraphQL & Clients
Overview of GraphQL & ClientsPokai Chang
 
Tomer Elmalem - GraphQL APIs: REST in Peace - Codemotion Milan 2017
Tomer Elmalem - GraphQL APIs: REST in Peace - Codemotion Milan 2017Tomer Elmalem - GraphQL APIs: REST in Peace - Codemotion Milan 2017
Tomer Elmalem - GraphQL APIs: REST in Peace - Codemotion Milan 2017Codemotion
 
Ember Data and JSON API
Ember Data and JSON APIEmber Data and JSON API
Ember Data and JSON APIyoranbe
 
The Magic Revealed: Four Real-World Examples of Using the Client Object Model...
The Magic Revealed: Four Real-World Examples of Using the Client Object Model...The Magic Revealed: Four Real-World Examples of Using the Client Object Model...
The Magic Revealed: Four Real-World Examples of Using the Client Object Model...SPTechCon
 
Zensations Drupal 8 GraphQL Presentation 2015
Zensations Drupal 8 GraphQL Presentation 2015Zensations Drupal 8 GraphQL Presentation 2015
Zensations Drupal 8 GraphQL Presentation 2015Zensations GmbH
 
Enter the app era with ruby on rails (rubyday)
Enter the app era with ruby on rails (rubyday)Enter the app era with ruby on rails (rubyday)
Enter the app era with ruby on rails (rubyday)Matteo Collina
 
Finding Restfulness - Madrid.rb April 2014
Finding Restfulness - Madrid.rb April 2014Finding Restfulness - Madrid.rb April 2014
Finding Restfulness - Madrid.rb April 2014samlown
 
Ruby on Rails: Tasty Burgers
Ruby on Rails: Tasty BurgersRuby on Rails: Tasty Burgers
Ruby on Rails: Tasty BurgersAaron Patterson
 
Big Data Web applications for Interactive Hadoop by ENRICO BERTI at Big Data...
 Big Data Web applications for Interactive Hadoop by ENRICO BERTI at Big Data... Big Data Web applications for Interactive Hadoop by ENRICO BERTI at Big Data...
Big Data Web applications for Interactive Hadoop by ENRICO BERTI at Big Data...Big Data Spain
 

Similar a RESTful APIs: Promises & lies (20)

Data models in Angular 1 & 2
Data models in Angular 1 & 2Data models in Angular 1 & 2
Data models in Angular 1 & 2
 
Single Page Web Applications with CoffeeScript, Backbone and Jasmine
Single Page Web Applications with CoffeeScript, Backbone and JasmineSingle Page Web Applications with CoffeeScript, Backbone and Jasmine
Single Page Web Applications with CoffeeScript, Backbone and Jasmine
 
Ams adapters
Ams adaptersAms adapters
Ams adapters
 
Seu primeiro app Android e iOS com Compose Multiplatform
Seu primeiro app Android e iOS com Compose MultiplatformSeu primeiro app Android e iOS com Compose Multiplatform
Seu primeiro app Android e iOS com Compose Multiplatform
 
Introduction to node.js
Introduction to node.jsIntroduction to node.js
Introduction to node.js
 
Play á la Rails
Play á la RailsPlay á la Rails
Play á la Rails
 
Crossing the Bridge: Connecting Rails and your Front-end Framework
Crossing the Bridge: Connecting Rails and your Front-end FrameworkCrossing the Bridge: Connecting Rails and your Front-end Framework
Crossing the Bridge: Connecting Rails and your Front-end Framework
 
GraphQL & Relay - 串起前後端世界的橋樑
GraphQL & Relay - 串起前後端世界的橋樑GraphQL & Relay - 串起前後端世界的橋樑
GraphQL & Relay - 串起前後端世界的橋樑
 
Stop the noise! - Introduction to the JSON:API specification in Drupal
Stop the noise! - Introduction to the JSON:API specification in DrupalStop the noise! - Introduction to the JSON:API specification in Drupal
Stop the noise! - Introduction to the JSON:API specification in Drupal
 
Overview of GraphQL & Clients
Overview of GraphQL & ClientsOverview of GraphQL & Clients
Overview of GraphQL & Clients
 
Tomer Elmalem - GraphQL APIs: REST in Peace - Codemotion Milan 2017
Tomer Elmalem - GraphQL APIs: REST in Peace - Codemotion Milan 2017Tomer Elmalem - GraphQL APIs: REST in Peace - Codemotion Milan 2017
Tomer Elmalem - GraphQL APIs: REST in Peace - Codemotion Milan 2017
 
Ember Data and JSON API
Ember Data and JSON APIEmber Data and JSON API
Ember Data and JSON API
 
JSON and the APInauts
JSON and the APInautsJSON and the APInauts
JSON and the APInauts
 
The Magic Revealed: Four Real-World Examples of Using the Client Object Model...
The Magic Revealed: Four Real-World Examples of Using the Client Object Model...The Magic Revealed: Four Real-World Examples of Using the Client Object Model...
The Magic Revealed: Four Real-World Examples of Using the Client Object Model...
 
Zensations Drupal 8 GraphQL Presentation 2015
Zensations Drupal 8 GraphQL Presentation 2015Zensations Drupal 8 GraphQL Presentation 2015
Zensations Drupal 8 GraphQL Presentation 2015
 
Enter the app era with ruby on rails (rubyday)
Enter the app era with ruby on rails (rubyday)Enter the app era with ruby on rails (rubyday)
Enter the app era with ruby on rails (rubyday)
 
Finding Restfulness - Madrid.rb April 2014
Finding Restfulness - Madrid.rb April 2014Finding Restfulness - Madrid.rb April 2014
Finding Restfulness - Madrid.rb April 2014
 
Ruby on Rails: Tasty Burgers
Ruby on Rails: Tasty BurgersRuby on Rails: Tasty Burgers
Ruby on Rails: Tasty Burgers
 
Big Data Web applications for Interactive Hadoop by ENRICO BERTI at Big Data...
 Big Data Web applications for Interactive Hadoop by ENRICO BERTI at Big Data... Big Data Web applications for Interactive Hadoop by ENRICO BERTI at Big Data...
Big Data Web applications for Interactive Hadoop by ENRICO BERTI at Big Data...
 
ORM in Django
ORM in DjangoORM in Django
ORM in Django
 

Más de Tareque Hossain

django Forms in a Web API World
django Forms in a Web API Worlddjango Forms in a Web API World
django Forms in a Web API WorldTareque Hossain
 
Life in a Queue - Using Message Queue with django
Life in a Queue - Using Message Queue with djangoLife in a Queue - Using Message Queue with django
Life in a Queue - Using Message Queue with djangoTareque Hossain
 
Introducing KMux - The Kernel Multiplexer
Introducing KMux - The Kernel MultiplexerIntroducing KMux - The Kernel Multiplexer
Introducing KMux - The Kernel MultiplexerTareque Hossain
 
SIGTRAN - An Introduction
SIGTRAN - An IntroductionSIGTRAN - An Introduction
SIGTRAN - An IntroductionTareque Hossain
 
Xen & the Art of Virtualization
Xen & the Art of VirtualizationXen & the Art of Virtualization
Xen & the Art of VirtualizationTareque Hossain
 
Introduction to django-config
Introduction to django-configIntroduction to django-config
Introduction to django-configTareque Hossain
 

Más de Tareque Hossain (9)

django Forms in a Web API World
django Forms in a Web API Worlddjango Forms in a Web API World
django Forms in a Web API World
 
The solr power
The solr powerThe solr power
The solr power
 
Life in a Queue - Using Message Queue with django
Life in a Queue - Using Message Queue with djangoLife in a Queue - Using Message Queue with django
Life in a Queue - Using Message Queue with django
 
Introducing KMux - The Kernel Multiplexer
Introducing KMux - The Kernel MultiplexerIntroducing KMux - The Kernel Multiplexer
Introducing KMux - The Kernel Multiplexer
 
SIGTRAN - An Introduction
SIGTRAN - An IntroductionSIGTRAN - An Introduction
SIGTRAN - An Introduction
 
Django orm-tips
Django orm-tipsDjango orm-tips
Django orm-tips
 
Django Deployment
Django DeploymentDjango Deployment
Django Deployment
 
Xen & the Art of Virtualization
Xen & the Art of VirtualizationXen & the Art of Virtualization
Xen & the Art of Virtualization
 
Introduction to django-config
Introduction to django-configIntroduction to django-config
Introduction to django-config
 

Último

Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 

Último (20)

Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 

RESTful APIs: Promises & lies

Notas del editor

  1. ----- Meeting Notes (9/7/11 09:17) -----Let's take a look at these company logos. You are familiar with most of them
  2. Take a look again!
  3. Because
  4. So what’s the deal with promises & lies?
  5. So how do start building APIs? Do you make a django project and spit some json out?
  6. And you get magical API
  7. Unfortunately, that’s not true
  8. You just have to ask yourself a few questions..
  9. RESTful APIs are stateless, cacheable and relies on HTTP methods
  10. In RESTful APIs, handlers..
  11. Speaking of resources
  12. Resources are units of information that are of interest to your clients..
  13. Units of information
  14. Just like Kitkat
  15. Now let’s take a look at the resource that can be built around that.. Besides some model attributes, it includes editions. Editions have further attributes that are of interest to API consumers. Lastly, there can be attributes that are very specific to the consumer requesting the resource.
  16. Now let’s put them next to each other for a better understanding
  17. Remember this guy
  18. He always brought friends
  19. Many friends
  20. How was Neo able to fight them off, all by himself?
  21. Because they were all agents Smiths. Their tactics were uniform. So Neo knew exactly how to approach them.
  22. So wrap them in envelopes
  23. Include information like.. when appropriate
  24. For example you can deliver a response that has HTTP status code, errors and finally the data for a successful GET request
  25. If a POST or PUT request fails, you can add the error metadata to your response.Makes it easy for the client to understand what exactly went wrong
  26. Let’s take a look at a response that provides pagination information. You can include fields like how many results were found, how many pages that maps to etc.
  27. You should remember..
  28. It’s perfectly alright to have multiple serialization formats if you can accommodate the extra efforts
  29. But don’t accept serialization formats as GET parameters
  30. Like that
  31. Or they can choose not to
  32. Like that
  33. Starting with Oauth 2.0 it’s mandated that you use HTTPS for calls to protected resources..
  34. How do you minimize that complexity
  35. Next, API frameworks
  36. Next, API frameworks
  37. A major feature we added was..
  38. Lets take a look at that now.. this is how you’d define the resource for the Book model we previously discussed. It takes an object and uses your definitions to create a resource
  39. Once you have that definition, you callit like this..
  40. For example you can deliver a response that has HTTP status code, errors and finally the data for a successful GET request
  41. You can find all necessary information about this enhanced django piston on PBS Education’s Github profile
  42. We did!