Teach a dog to 
REST 
… yeah, that one is stolen ;D
I 
Why dogs ?
The world is huge 
A puppies World is huge. 
You have other dogs, cats, people, places, vets, colours 
and much more. 
Easy to connect with and understand basic concepts in an 
fluffy way :)
II 
Whats an API
Application programming interface 
It's an convenient way to interact with an Application from 
the outside. ( Earlier we had special Protocols like SOAP 
and co )
I never used one 
The chance you already used an API without knowing is 
pretty darn high. ( Apps! Facebook, Twitter, you-name-it)
Okay, how does it work ? 
It's a predefined way to POST or GET Content from an 
special resource. Let's look at some examples:
Okay, how does it work ? 
/showmesomedogs 
/getavailabledogfood 
/whereisavet 
/storenewdogdata
III 
Bad API
/store-new-dog 
/get-all-dogs 
/show-me-dog/{id} 
/get-all-dogs-with-color/{color} 
/save-new-owner 
/locations 
/vet/{id}
IV 
So what makes a good 
API
RESTful 
Representational state transfer (REST)
RESTful 
This means that there is a strict separation between Client 
and Server and the communication itself should be 
stateless.
RESTful 
This also means every request should work regardless of 
what you did last.
Okay, how does it work ? 
So basically there are URLs you talk to with a HTTP Verb 
POST, 
GET, 
PUT, 
DELETE
CRUD 
You may also know this as 
CREATE 
READ 
UPDATE 
DELETE
V 
Basic Rules
Resources 
Work with Resources and identifiers. 
/dogs 
/dogs/{id}
Parameters 
Use Parameters if you want to get very specific 
&color=brown 
Keep them Optional!!!
Verbs - Nouns 
Verbs are BAD 
Nouns are GOOD
Dog…s… ? 
Singular or Plural ? 
Stick to it!
How Specific 
things ? 
animals ? 
people ?
Version 
It's always good to version your API 
&v=1 
- or - 
/v1/dogs
Results 
Always return a HTTP Number. 
ex: 200,301,404
Communication 
JSON ? 
JSON ! 
( XML, ATOM, …)
VI 
Example
CRUD 
GET /dogs — return ALL dogs 
POST /dogs — create a NEW dog and return ID 
GET /dogs/{id} — return dog with this ID 
PUT /dogs/{id} — update this dog 
DELETE /dogs/{id} — delete this dog
Specific 
GET /dogs/{id}/owners — return the owners of the dog 
GET /owners/{id}/dogs — return the dog(s) of the owners
Specific 
Don't nest too deep!
VII 
TODOs
It's TODO time again 
Get into Groups of four (!?) 
Describe your Project briefly and the goal of the API 
Design your Projects API ( Parameters and stuff ) 
60 min time 
10 min Presentation each group 
5 min Feedback
VIII 
Extras
Dos 
Use existing Frameworks and Tools to create your APIs. 
Define some Ground-rules for your API Design as early as 
possible to stay consistent from the beginning. 
Having APIs in Mind for Backend-development also helps 
in using Frameworks like AngularJS and co.
Donts 
Don't reinvent the Wheel. 
Orient on best practice examples because a lot of people 
put a lot of thought in those already. 
Don't reinvent the Wheel. (even if its tempting)
… 
REST in Peace 
REST-API's and JSON are the closest 
thing we have to a common language. 
Use this tools to create awsm stuff and make 
a developers life as easy as possible :)
IX 
Questions ?

Introduction to RESTful API Designs

  • 1.
    Teach a dogto REST … yeah, that one is stolen ;D
  • 2.
  • 3.
    The world ishuge A puppies World is huge. You have other dogs, cats, people, places, vets, colours and much more. Easy to connect with and understand basic concepts in an fluffy way :)
  • 4.
  • 5.
    Application programming interface It's an convenient way to interact with an Application from the outside. ( Earlier we had special Protocols like SOAP and co )
  • 6.
    I never usedone The chance you already used an API without knowing is pretty darn high. ( Apps! Facebook, Twitter, you-name-it)
  • 7.
    Okay, how doesit work ? It's a predefined way to POST or GET Content from an special resource. Let's look at some examples:
  • 8.
    Okay, how doesit work ? /showmesomedogs /getavailabledogfood /whereisavet /storenewdogdata
  • 9.
  • 10.
    /store-new-dog /get-all-dogs /show-me-dog/{id} /get-all-dogs-with-color/{color} /save-new-owner /locations /vet/{id}
  • 11.
    IV So whatmakes a good API
  • 12.
  • 13.
    RESTful This meansthat there is a strict separation between Client and Server and the communication itself should be stateless.
  • 14.
    RESTful This alsomeans every request should work regardless of what you did last.
  • 15.
    Okay, how doesit work ? So basically there are URLs you talk to with a HTTP Verb POST, GET, PUT, DELETE
  • 16.
    CRUD You mayalso know this as CREATE READ UPDATE DELETE
  • 17.
  • 18.
    Resources Work withResources and identifiers. /dogs /dogs/{id}
  • 19.
    Parameters Use Parametersif you want to get very specific &color=brown Keep them Optional!!!
  • 20.
    Verbs - Nouns Verbs are BAD Nouns are GOOD
  • 21.
    Dog…s… ? Singularor Plural ? Stick to it!
  • 22.
    How Specific things? animals ? people ?
  • 23.
    Version It's alwaysgood to version your API &v=1 - or - /v1/dogs
  • 24.
    Results Always returna HTTP Number. ex: 200,301,404
  • 25.
    Communication JSON ? JSON ! ( XML, ATOM, …)
  • 26.
  • 27.
    CRUD GET /dogs— return ALL dogs POST /dogs — create a NEW dog and return ID GET /dogs/{id} — return dog with this ID PUT /dogs/{id} — update this dog DELETE /dogs/{id} — delete this dog
  • 28.
    Specific GET /dogs/{id}/owners— return the owners of the dog GET /owners/{id}/dogs — return the dog(s) of the owners
  • 29.
  • 30.
  • 31.
    It's TODO timeagain Get into Groups of four (!?) Describe your Project briefly and the goal of the API Design your Projects API ( Parameters and stuff ) 60 min time 10 min Presentation each group 5 min Feedback
  • 32.
  • 33.
    Dos Use existingFrameworks and Tools to create your APIs. Define some Ground-rules for your API Design as early as possible to stay consistent from the beginning. Having APIs in Mind for Backend-development also helps in using Frameworks like AngularJS and co.
  • 34.
    Donts Don't reinventthe Wheel. Orient on best practice examples because a lot of people put a lot of thought in those already. Don't reinvent the Wheel. (even if its tempting)
  • 35.
    … REST inPeace REST-API's and JSON are the closest thing we have to a common language. Use this tools to create awsm stuff and make a developers life as easy as possible :)
  • 36.