Upload
yonatan-maman
View
633
Download
0
Embed Size (px)
Citation preview
“Boss, Boss hi API i not RESTful”
* min {control on usage}* max {responsibility}* decisions.exist {_.takeAtDay1}
* min {control on usage}* max {responsibility}* decisions.exist {_.takeAtDay1}
Be PragmaticMake reasonable
compromise
Be consistently consistent
* HTTP methods* HTTP codes* Headers* Authentication
No one likes surprises
Make your users feel at home
Use Standards:
Error handling
It is all about the Expectations
GET
POST
PUT
/customers/{id}
/customers
/customers
REQUEST RESPONSE
customerGET
customercustomer
customercustomer*
200
201
200
Can we have both ?
To embed || !to embed ?
SimpleAll you need in one requestFewer transactions
SimpleAll you need in one requestFewer transactions
FastBuilding blockflexibilityCacheable
FastBuilding blockflexibilityCacheable
!to embed
to embed
and do it right ?*
Documentationapiary.io
Swager
Mashape and More...
apiary.io
Swager
Mashape and More...
* Be consistent* Focus on Resources* Less > More* Examples
* Be consistent* Focus on Resources* Less > More* Examples
" עבודה במקביל – הצלחה לכל דביל”
" עבודה במקביל – הצלחה לכל דביל”
** Sand-box ? +1** Sand-box ? +1
“Authorization”
“privacy” , your privacy
“Authorization”
“privacy” , your privacy
Bi Directional mapping using secret key -
HOW?
Tip #2
Add another column in the DB
27847321845691
Like a version
OR/SUPPORT/multiple/VERSIONS/v2.5/
/SELL/your/soul/to/backwards/compatibility
URI should control
identity not presentationhttp://bit.ly/1Mo0yXF
===>GET /customer/1 HTTP/1.1Accept: application/outbrain.customer-v2.5+json
===>GET /customer/1 HTTP/1.1Accept: application/outbrain.customer-v2.5+json
<===HTTP/1.1 200 OKContent-Type: application/outbrain.customer-v2.5+json
<===HTTP/1.1 200 OKContent-Type: application/outbrain.customer-v2.5+json
Like a version
– One ?– Three ?– Four ?
– One ?– Three ?– Four ?
Quiz #3How many Types do you need ?
GET /customer/1
PUT /customer/1POST /customer/1
JSON 2 Case Class [Scala]
http://json2caseclass.cleverapps.io/http://json2caseclass.cleverapps.io/
.json
.scala