SlideShare a Scribd company logo
Beautiful REST+JSON APIs
with Ion
Les Hazlewood @lhazlewood
CTO, Stormpath, stormpath.com
@lhazlewood @goStormpath
.com
โ€ข User Management API for Developers
โ€ข Password security
โ€ข Authentication and Authorization
โ€ข LDAP/AD/Social/SAML/OAuth support
โ€ข Instant-on, scalable, and highly available
โ€ข Free for developers
@lhazlewood @goStormpath
Why REST?
โ€ข Scalability
โ€ข Generality
โ€ข Independence
โ€ข Latency (Caching)
โ€ข Security
โ€ข Encapsulation
@lhazlewood @goStormpath
Why JSON?
โ€ข Ubiquity
โ€ข Simplicity
โ€ข Readability
โ€ข Scalability
โ€ข Flexibility
@lhazlewood @goStormpath
REST Is Easy
@lhazlewood @goStormpath
REST Is *&@#$! Hard
(for providers)
@lhazlewood @goStormpath
JSON โ€“ No Spec
@lhazlewood @goStormpath
REST can be easy
(if you follow some guidelines)
@lhazlewood @goStormpath
HATEOAS
โ€ข Hypermedia
โ€ข As
โ€ข The
โ€ข Engine
โ€ข Of
โ€ข Application
โ€ข State
@lhazlewood @goStormpath
HATEOAS
โ€ข Links
โ€ข State Transitions
@lhazlewood @goStormpath
Fieldingโ€™s Requirements
roy.gbiv.com/untangled/2008/rest-apis-must-be-hypertext-
driven:
โ€ข Communication Protocol Independent
โ€ข Media Type Centric
โ€ข No Fixed Names / Hierarchies
โ€ข Dynamically Typed!
โ€ข ZERO OUT-OF-BAND KNOWLEDGE
@lhazlewood @goStormpath
How do we meet these
requirements?
@lhazlewood @goStormpath
How do we...?
Base URL
Versioning
Resource Format
Return Values
Content Negotiation
References (Linking)
Pagination
Query Parameters
Create/Update
Search
Associations
Errors
IDs
Method Overloading
Resource Expansion
Partial Responses
Caching & Etags
Security
Multi Tenancy
Maintenance
Batch Operations
@lhazlewood @goStormpath
Fundamentals
@lhazlewood @goStormpath
Resources
Nouns, not Verbs
Coarse Grained, not Fine Grained
Architectural style for use-case scalability
@lhazlewood @goStormpath
What If?
/getAccount
/createDirectory
/updateGroup
/verifyAccountEmailAddress
@lhazlewood @goStormpath
What If?
/getAccount
/getAllAccounts
/searchAccounts
/createDirectory
/createLdapDirectory
/updateGroup
/updateGroupName
/findGroupsByDirectory
/searchGroupsByName
/verifyAccountEmailAddress
/verifyAccountEmailAddressByToken
โ€ฆ
Smells like bad RPC. DONโ€™T DO THIS.
@lhazlewood @goStormpath
Keep It Simple
@lhazlewood @goStormpath
The Answer
Fundamentally two types of resources:
Collection Resource
Instance Resource
@lhazlewood @goStormpath
Collection Resource
/applications
@lhazlewood @goStormpath
Instance Resource
/applications/a1b2c3
@lhazlewood @goStormpath
Behavior
โ€ข GET
โ€ข PUT
โ€ข POST
โ€ข DELETE
โ€ข HEAD
@lhazlewood @goStormpath
Behavior
POST, GET, PUT, DELETE
โ‰  1:1
Create, Read, Update, Delete
@lhazlewood @goStormpath
Behavior
As you would expect:
GET = Read
DELETE = Delete
HEAD = Headers, no Body
@lhazlewood @goStormpath
Behavior
Not so obvious:
PUT and POST can both be used for
Create and Update
@lhazlewood @goStormpath
PUT for Create
Identifier is known by the client:
PUT /applications/clientSpecifiedId
{
โ€ฆ
}
@lhazlewood @goStormpath
PUT for Update
Full Replacement
PUT /applications/existingId
{
โ€œnameโ€: โ€œBest App Everโ€,
โ€œdescriptionโ€: โ€œAwesomenessโ€
}
@lhazlewood @goStormpath
PUT
Idempotent
@lhazlewood @goStormpath
POST as Create
On a parent resource
POST /applications
{
โ€œnameโ€: โ€œBest App Everโ€
}
Response:
201 Created
Location: https://api.stormpath.com/applications/a1b2c3
@lhazlewood @goStormpath
POST as Update
On instance resource
POST /applications/a1b2c3
{
โ€œnameโ€: โ€œBest App Ever. Srsly.โ€
}
Response:
200 OK
@lhazlewood @goStormpath
POST
NOT Idempotent
@lhazlewood @goStormpath
Media Types
โ€ข Format Specification + Parsing Rules
โ€ข Request: Accept header
โ€ข Response: Content-Type header
โ€ข application/json
โ€ข application/ion+json
โ€ข application/ion+json;v=2
โ€ข โ€ฆ
@lhazlewood @goStormpath
Design Time!
@lhazlewood @goStormpath
HATEAOS in JSON: Ion
@lhazlewood @goStormpath
Resources
@lhazlewood @goStormpath
Object
{
โ€œfirstNameโ€: โ€œBobโ€,
โ€œlastNameโ€: โ€œSmithโ€,
โ€œbirthDateโ€: โ€œ1980-01-23โ€,
}
@lhazlewood @goStormpath
Ion Object
{
โ€œmetaโ€: { ... },
โ€œfirstNameโ€: โ€œBobโ€,
โ€œlastNameโ€: โ€œSmithโ€,
โ€œbirthDateโ€: โ€œ1980-01-23โ€,
}
@lhazlewood @goStormpath
Naรฏve collection (not recommended)
โ€œitemsโ€: []
@lhazlewood @goStormpath
Collection Object
{
โ€œitemsโ€: []
}
@lhazlewood @goStormpath
Ion Collection
{
โ€œmetaโ€: { ... },
โ€œitemsโ€: []
}
@lhazlewood @goStormpath
Linking
@lhazlewood @goStormpath
HREF
โ€ข Distributed Hypermedia is paramount!
โ€ข Every accessible Resource has a canonical unique
URL
โ€ข Replaces IDs (IDs exist, but are opaque).
โ€ข Critical for linking
@lhazlewood @goStormpath
Linking in JSON?
โ€ข XML has it (XLink), JSON doesnโ€™t
โ€ข How do we do it?
@lhazlewood @goStormpath
Naรฏve linking
@lhazlewood @goStormpath
Naรฏve linking - instance
GET /accounts/x7y8z9
200 OK
{
โ€œgivenNameโ€: โ€œTonyโ€,
โ€œsurnameโ€: โ€œStarkโ€,
โ€ฆ,
โ€œdirectoryโ€: ????
}
@lhazlewood @goStormpath
Naรฏve linking - instance contโ€™d
GET /accounts/x7y8z9
200 OK
{
โ€œgivenNameโ€: โ€œTonyโ€,
โ€œsurnameโ€: โ€œStarkโ€,
โ€ฆ,
โ€œdirectoryโ€: {
โ€œhrefโ€: โ€œhttps://api.stormpath.com/v1/directories/g4h5i6โ€
}
}
@lhazlewood @goStormpath
Naรฏve linking - collection
GET /accounts/x7y8z9
200 OK
{
โ€œgivenNameโ€: โ€œTonyโ€,
โ€œsurnameโ€: โ€œStarkโ€,
โ€ฆ,
โ€œgroupsโ€: {
โ€œhrefโ€: โ€œhttps://api.stormpath.com/accounts/x7y8z9/groupsโ€
}
}
@lhazlewood @goStormpath
Ion linking (recommended)
@lhazlewood @goStormpath
Ion meta href
GET /accounts/x7y8z9
200 OK
{
โ€œmetaโ€: { โ€œhrefโ€: โ€œhttps://api.stormpath.com/accounts/x7y8z9โ€ },
โ€œgivenNameโ€: โ€œTonyโ€,
โ€œsurnameโ€: โ€œStarkโ€,
โ€ฆ
}
@lhazlewood @goStormpath
Ion link
GET /accounts/x7y8z9
200 OK
{
โ€œmetaโ€: { ... },
โ€œgivenNameโ€: โ€œTonyโ€,
โ€œsurnameโ€: โ€œStarkโ€,
โ€ฆ,
โ€œdirectoryโ€: {
โ€œmetaโ€:{ โ€œhrefโ€: https://api.stormpath.com/directories/g4h5i6โ€ }
}
}
@lhazlewood @goStormpath
Ion link (collection)
GET /accounts/x7y8z9
200 OK
{
โ€œmetaโ€: { ... },
โ€œgivenNameโ€: โ€œTonyโ€,
โ€œsurnameโ€: โ€œStarkโ€,
โ€ฆ,
โ€œgroupsโ€: {
โ€œmetaโ€: {
โ€œhrefโ€: โ€œhttps://api.stormpath.com/accounts/x7y8z9/groupsโ€, โ€œrelโ€: [โ€œcollectionโ€]
}
}
}
@lhazlewood @goStormpath
What about HAL?
โ€ข Linking focus
โ€ข Forces links to be separate from context/content
โ€“ (when was the last time you had to put all of your anchors at
the bottom of an html paragraph? Right... never.)
โ€ข In contrast to HAL, Ion is much more like HTML โ€“ itโ€™s all in
one convenient spec.
โ€ข Ion transliteration to/from HTML is far easier (by design)
@lhazlewood @goStormpath
State Transitions
@lhazlewood @goStormpath
Creating And Updating
@lhazlewood @goStormpath
Remember HATEOS?
@lhazlewood @goStormpath
โ€œLet me go read the docs to figure
out how to POSTโ€
@lhazlewood @goStormpath
NO! This is not HATEOS.
@lhazlewood @goStormpath
How do browsers work?
@lhazlewood @goStormpath
Forms
@lhazlewood @goStormpath
Forms: Create
{
โ€œfooโ€: โ€œbarโ€,
โ€œbazโ€: โ€œbooโ€,
...
โ€œcreateAccountโ€: {
โ€œmetaโ€: {โ€œhrefโ€: โ€œhttps://foo.io/usersโ€, โ€œrelโ€: [โ€œcreate-formโ€], โ€œmethodโ€: โ€œPOSTโ€},
โ€œitemsโ€: [
{โ€œnameโ€: โ€œloginโ€, โ€œrequiredโ€: โ€œtrueโ€, โ€œlabelโ€: โ€œUsername or Emailโ€ },
{โ€œnameโ€: โ€œpasswordโ€, โ€œsecretโ€: โ€œtrueโ€, โ€œrequiredโ€: โ€œtrueโ€, โ€œlabelโ€: โ€œPasswordโ€}
]
}
}
@lhazlewood @goStormpath
Forms: Create contโ€™d
{
"meta": {"href": "https://example.io/users", "rel":["create-form"], "method":"POST"},
"items": [
{"name":"username"},
{"name": "password", "secret": true },
{"name": "visitedContinents","type": "set", "minitems": 1,"maxitems": 7,"options": {
"items": [
{"label": "Africa", "value": "af" },
{"label": "North America", "value": "na" },
{"label": "South America", "value": "sa" },
{"label": "Europe", "value": "eu" },
{"label": "Asia", "value": "as" },
{"label": "Oceania", "value": "oc" },
{"label": "Antarctica", "value": "an" },
]
}
}
]
}
@lhazlewood @goStormpath
Forms: Search / Query{
...
โ€œfindAccountsโ€: {
โ€œmetaโ€: { โ€œhrefโ€: โ€œhttps://foo.io/usersโ€, โ€œrelโ€: [โ€œsearch-formโ€], โ€œmethodโ€: โ€œGETโ€ },
โ€œitemsโ€: [
{โ€œnameโ€: โ€œusernameโ€, โ€œlabelโ€: โ€œUsernameโ€},
{โ€œnameโ€: โ€œemailโ€, โ€œtypeโ€: โ€œemailโ€, โ€œlabelโ€: โ€œEmailโ€ },
{โ€œnameโ€: โ€œgivenNameโ€, โ€œlabelโ€: โ€œFirst Nameโ€ },
{โ€œnameโ€: โ€œsurnameโ€, โ€œlabelโ€: โ€œLast Nameโ€},
]
}
}
@lhazlewood @goStormpath
What about Schemas / json-schema ?
Not needed. REST != RDBMS
(are schemas necessary for browsers/HTML?)
Forms do the same thing and are more flexible/powerful
Remember Fieldingโ€™s REST Rule about Dynamic Typing
@lhazlewood @goStormpath
HTTP Protocol Semantics
@lhazlewood @goStormpath
Base URL
@lhazlewood @goStormpath
http(s)://foo.io
vs
http://www.foo.com/dev/service/api/rest
@lhazlewood @goStormpath
http(s)://foo.io
Rest Client
vs
Browser
@lhazlewood @goStormpath
Versioning
@lhazlewood @goStormpath
URL
https://api.stormpath.com/v1
vs.
Media-Type
application/json
application/ion+json
@lhazlewood @goStormpath
Content Negotiation
@lhazlewood @goStormpath
Header
โ€ข Accept header
โ€ข Header values comma delimited
โ€ข q param determines precedence, defaults to 1, then
conventionally by list order
GET /applications/a1b2c3
Accept: application/json, text/plain;q=0.8
@lhazlewood @goStormpath
Resource Extension
/applications/a1b2c3.json
/applications/a1b2c3.csv
โ€ฆ
Conventionally overrides Accept header
@lhazlewood @goStormpath
Style Guide
@lhazlewood @goStormpath
camelCase
โ€˜JSโ€™ in โ€˜JSONโ€™ = JavaScript
myArray.forEach
Not myArray.for_each
account.givenName
Not account.given_name
Underscores for property/function names are unconventional
for JS. Stay consistent.
@lhazlewood @goStormpath
Dates & Times
@lhazlewood @goStormpath
Dates & Times
Thereโ€™s already a standard. Use it: ISO 8601
โ€œcreatedAtโ€: โ€œ2013-07-10T18:02:24.343Zโ€
Use UTC!
This is represented in Ion as a field types of date, time,
datetime, etc.
@lhazlewood @goStormpath
createdAt / updatedAt
Most people will want this at some point
{
โ€ฆ,
โ€œcreatedAtโ€: โ€œ2013-07-10T18:02:24.343Zโ€,
โ€œupdatedAtโ€: โ€œ2014-09-29T07:02:48.761Zโ€
}
Use UTC!
@lhazlewood @goStormpath
Reference Expansion
(aka Entity Expansion, Link Expansion)
@lhazlewood @goStormpath
Account and its Directory?
@lhazlewood @goStormpath
GET /accounts/x7y8z9?expand=directory
200 OK
{
โ€œmetaโ€: {..., โ€œexpandableโ€: [โ€œdirectoryโ€,...] },
โ€œgivenNameโ€: โ€œTonyโ€,
โ€œsurnameโ€: โ€œStarkโ€,
โ€ฆ,
โ€œdirectoryโ€: {
โ€œmetaโ€: { ... },
โ€œnameโ€: โ€œAvengersโ€,
โ€œdescriptionโ€: โ€œHollywoodโ€™s plan for more $โ€,
โ€œcreatedAtโ€: โ€œ2012-07-01T14:22:18.029Zโ€,
โ€ฆ
}
}
@lhazlewood @goStormpath
Collection Pagination
@lhazlewood @goStormpath
Ensure Collection Resources support query params:
โ€ข Offset + Limit vs Cursor
โ€ฆ/applications?offset=50&limit=25
โ€ข Donโ€™t require the user to query for these โ€“ provide OOTB links
@lhazlewood @goStormpath
GET /accounts/x7y8z9/groups
200 OK
{
โ€œmetaโ€: { ... },
โ€œoffsetโ€: 0,
โ€œlimitโ€: 25,
โ€œfirstโ€: { โ€œmetaโ€:{โ€œhrefโ€: โ€œโ€ฆ/accounts/x7y8z9/groups?offset=0โ€}},
โ€œpreviousโ€: null,
โ€œnextโ€: { โ€œmetaโ€:{โ€œhrefโ€: โ€œโ€ฆ/accounts/x7y8z9/groups?offset=25โ€}},
โ€œlastโ€: { โ€œmetaโ€:{โ€œhrefโ€: โ€œโ€ฆโ€}},
โ€œitemsโ€: [
{
โ€œmetaโ€: { โ€œhrefโ€: โ€œโ€ฆโ€, ...}
},
{
โ€œmetaโ€: { โ€œhrefโ€: โ€œโ€ฆโ€, ...}
},
โ€ฆ
]
}
@lhazlewood @goStormpath
Sorting
@lhazlewood @goStormpath
GET .../accounts?
orderBy=surname,givenName%20desc
@lhazlewood @goStormpath
Search
@lhazlewood @goStormpath
โ€œFind all accounts with a
โ€˜company.comโ€™ email address
that can login to a particular
applicationโ€
@lhazlewood @goStormpath
GET /applications/x7y8z9/accounts?email=*company.com
200 OK
{
โ€œmetaโ€: { ... },
โ€œoffsetโ€: 0,
โ€œlimitโ€: 25,
โ€œfirstโ€: { โ€œmetaโ€:{
โ€œhrefโ€:โ€œ/applications/x7y8z9/accounts?email=*company.com&offset=0โ€}
},
โ€œpreviousโ€: null,
โ€œnextโ€: { โ€œmetaโ€:{
โ€œhrefโ€: โ€œ/applications/x7y8z9/accounts?email=*company.com&offset=25โ€}
},
โ€œlastโ€: { โ€œmetaโ€:{โ€œhrefโ€: โ€œโ€ฆโ€}},
โ€œitemsโ€: [
{ โ€œmetaโ€: { โ€œhrefโ€: โ€œโ€ฆโ€, ...} },
{ โ€œmetaโ€: { โ€œhrefโ€: โ€œโ€ฆโ€, ...} },
โ€ฆ
]
}
@lhazlewood @goStormpath
Search contโ€™d
โ€ข Filter search
.../accounts?q=some+value
โ€ข Attribute Search
.../accounts?surname=Joe&email=*company.com
@lhazlewood @goStormpath
Search contโ€™d
โ€ข Starts with
?email=joe*
โ€ข Ends with
?email=*company.com
โ€ข Contains (warning! Bad performance)
?email=*foo*
@lhazlewood @goStormpath
Search contโ€™d
โ€ข Range queries via Ion min and max field members
โ€œall accounts created between September 1st and the 15thโ€
Form fields example:
{โ€œnameโ€: โ€œcreatedAtBeginโ€, โ€œminโ€: โ€œ2014-01-01โ€,โ€max=โ€œ2014-12-31โ€}
{โ€œnameโ€: โ€œcreatedAtEndโ€, โ€œminโ€: โ€œ2014-01-01โ€,โ€max=โ€œ2014-12-31โ€}
Ion TBD: range type:
.../accounts?createdAt=[2014-09-01,2014-09-15]
@lhazlewood @goStormpath
Search contโ€™d
โ€ข Use Ion forms and the pattern form field member to
represent search expressions
@lhazlewood @goStormpath
Many To Many
@lhazlewood @goStormpath
Group to Account
โ€ข A group can have many accounts
โ€ข An account can be in many groups
โ€ข Each mapping is a resource:
GroupMembership
@lhazlewood @goStormpath
GET /groupMemberships/23lk3j2j3
200 OK
{
โ€œmetaโ€:{โ€œhrefโ€: โ€œโ€ฆ/groupMemberships/23lk3j2j3โ€},
โ€œaccountโ€: {
โ€œmetaโ€:{โ€œhrefโ€: โ€œโ€ฆโ€}
},
โ€œgroupโ€: {
โ€œmetaโ€{โ€œhrefโ€: โ€œโ€ฆโ€}
},
โ€ฆ
}
@lhazlewood @goStormpath
GET /accounts/x7y8z9
200 OK
{
โ€œmetaโ€:{โ€œhrefโ€: โ€œโ€ฆ/accounts/x7y8z9โ€},
โ€œgivenNameโ€: โ€œTonyโ€,
โ€œsurnameโ€: โ€œStarkโ€,
โ€ฆ,
โ€œgroupsโ€: {
โ€œmetaโ€:{โ€œhrefโ€: โ€œโ€ฆ/accounts/x7y8z9/groupsโ€ โ€œrelโ€: [โ€œcollectionโ€]}
},
โ€œgroupMembershipsโ€: {
โ€œmetaโ€:{โ€œhrefโ€: โ€œโ€ฆ/groupMemberships?accountId=x7y8z9โ€,โ€relโ€:[โ€œcollectionโ€]}
}
}
@lhazlewood @goStormpath
Async or Long-Lived Operations
@lhazlewood @goStormpath
POST /emails
{
โ€œfromโ€: me@somewhere.com,
โ€œsubjectโ€: โ€œHi!โ€
โ€œbodyโ€: โ€œ...โ€
}
@lhazlewood @goStormpath
204 Accepted
Location: /emails/23Sd932sSl
{
โ€œstatusโ€: โ€œqueuedโ€,
...
}
@lhazlewood @goStormpath
GET /emails/23Sd932sSl
Expires: 2014-09-29T18:00:00.000Z
{
โ€œstatusโ€: โ€œsentโ€,
...
}
@lhazlewood @goStormpath
Batch Operations
@lhazlewood @goStormpath
โ€ข Each batch is represented as a resource
โ€ข Batches are likely to be a collection
โ€ข Batches are likely to have a status
โ€ข Downside: problematic regarding HTTP caching
@lhazlewood @goStormpath
Batch Delete
โ€œDelete all company.com accountsโ€
DELETE /accounts?
email=*@company.com
@lhazlewood @goStormpath
Batch Create / Update
Already have a Collection concept. Use it.
@lhazlewood @goStormpath
Batch Create or Update
POST /accounts
{
โ€œmetaโ€: { ... },
โ€œitemsโ€: [
{ ... account 1 ... },
{ ... account 2 ... },
...
]
}
@lhazlewood @goStormpath
Batch Operations: The โ€˜Catchโ€™
HTTP Caching is bypassed entirely ๏Œ
@lhazlewood @goStormpath
204 Accepted
Location: /batches/a1b2c3
{
โ€œstatusโ€: โ€œprocessingโ€, //overall status
โ€œsizeโ€: โ€œnโ€,
โ€œlimitโ€: 25,
...,
โ€œitemsโ€: {
{ response 1 (w/ individual status) ...},
{ response 2 (w/ individual status) ...},
...
}
}
@lhazlewood @goStormpath
Errors
@lhazlewood @goStormpath
โ€ข As descriptive as possible
โ€ข As much information as possible
โ€ข Developers are your customers
@lhazlewood @goStormpath
POST /directories
409 Conflict
{
โ€œstatusโ€: 409,
โ€œcodeโ€: 40924,
โ€œpropertyโ€: โ€œnameโ€,
โ€œmessageโ€: โ€œA Directory named โ€˜Avengersโ€™ already exists.โ€,
โ€œdeveloperMessageโ€: โ€œA directory named โ€˜Avengersโ€™ already
exists. If you have a stale local cache, please expire it
now.โ€,
โ€œmoreInfoโ€: โ€œhttps://www.stormpath.com/docs/api/errors/40924โ€
}
@lhazlewood @goStormpath
Security
@lhazlewood @goStormpath
Avoid sessions when possible
Authenticate every request if necessary
Stateless
Authorize based on resource content, NOT URL!
Use Existing Protocol:
Oauth 1.0a, Oauth2, Basic over SSL only
Custom Authentication Scheme:
Only if you provide client code / SDK
Only if you really, really know what youโ€™re doing
Use API Keys and/or JWTs instead of Username/Passwords
@lhazlewood @goStormpath
401 vs 403
โ€ข 401 โ€œUnauthorizedโ€ really means Unauthenticated
โ€œYou need valid credentials for me to respond to this requestโ€
โ€ข 403 โ€œForbiddenโ€ really means Unauthorized
โ€œSorry, youโ€™re not allowed!โ€
@lhazlewood @goStormpath
HTTP Authentication Schemes
โ€ข Server response to issue challenge:
WWW-Authenticate: <scheme name>
realm=โ€œApplication Nameโ€
โ€ข Client request to submit credentials:
Authorization: <scheme name> <data>
@lhazlewood @goStormpath
API Keys
โ€ข Entropy
โ€ข Password Reset
โ€ข Independence
โ€ข Scope
โ€ข Speed
โ€ข Limited Exposure
โ€ข Traceability
@lhazlewood @goStormpath
IDs
@lhazlewood @goStormpath
โ€ข IDs should be opaque
โ€ข Should be globally unique
โ€ข Avoid sequential numbers (contention, fusking)
โ€ข Good candidates: UUIDs, โ€˜Url64โ€™
@lhazlewood @goStormpath
HTTP Method Overrides
@lhazlewood @goStormpath
POST /accounts/x7y8z9?_method=DELETE
@lhazlewood @goStormpath
Caching &
Concurrency Control
@lhazlewood @goStormpath
Server (initial response):
ETag: "686897696a7c876b7eโ€
Client (later request):
If-None-Match: "686897696a7c876b7eโ€
Server (later response):
304 Not Modified
@lhazlewood @goStormpath
Maintenance
@lhazlewood @goStormpath
Use HTTP Redirects
Create abstraction layer / endpoints when migrating
Use well defined custom Media Types
@lhazlewood @goStormpath
IETF RFC?
@lhazlewood @goStormpath
Ion Media Type
ionwg.org/draft-ion.html
@lhazlewood @goStormpath
.com
โ€ข Free for developers
โ€ข Eliminate months of development
โ€ข Automatic security best practices
โ€ข Single Sign On
โ€ข Social/OAuth/SAML/Multi-factor/etc
โ€ข API Authentication & Key Management
โ€ข Token Authentication for SPAs / Mobile
โ€ข Authorization & Multi-tenancy for your apps
Libraries and integrations:
https://docs.stormpath.com

More Related Content

What's hot (20)

PDF
Spark
Amir Payberah
ย 
PPTX
Java Stack Data Structure.pptx
vishal choudhary
ย 
PDF
Introduction to Redux
Ignacio Martรญn
ย 
PPTX
Scala Intro
Alexey (Mr_Mig) Migutsky
ย 
PDF
Intro to Asynchronous Javascript
Garrett Welson
ย 
PPTX
ShEx vs SHACL
Jose Emilio Labra Gayo
ย 
PPTX
Introduction to Node js
Akshay Mathur
ย 
PDF
Fundamental JavaScript [UTC, March 2014]
Aaron Gustafson
ย 
KEY
JSON-LD: JSON for Linked Data
Gregg Kellogg
ย 
PPT
Introduction to the Web API
Brad Genereaux
ย 
PPTX
Solr Search Engine: Optimize Is (Not) Bad for You
Sematext Group, Inc.
ย 
PPTX
Core Java Tutorials by Mahika Tutorials
Mahika Tutorials
ย 
PDF
Use Node.js to create a REST API
Fabien Vauchelles
ย 
PPTX
Building Next-Generation Web APIs with JSON-LD and Hydra
Markus Lanthaler
ย 
PDF
Apache Spark 2.0: A Deep Dive Into Structured Streaming - by Tathagata Das
Databricks
ย 
PDF
STL in C++
Surya Prakash Sahu
ย 
PPTX
REST-API introduction for developers
Patrick Savalle
ย 
PPTX
9. ES6 | Let And Const | TypeScript | JavaScript
pcnmtutorials
ย 
PPTX
Access specifiers(modifiers) in java
HrithikShinde
ย 
PPT
Heap sort
Mohd Arif
ย 
Spark
Amir Payberah
ย 
Java Stack Data Structure.pptx
vishal choudhary
ย 
Introduction to Redux
Ignacio Martรญn
ย 
Scala Intro
Alexey (Mr_Mig) Migutsky
ย 
Intro to Asynchronous Javascript
Garrett Welson
ย 
ShEx vs SHACL
Jose Emilio Labra Gayo
ย 
Introduction to Node js
Akshay Mathur
ย 
Fundamental JavaScript [UTC, March 2014]
Aaron Gustafson
ย 
JSON-LD: JSON for Linked Data
Gregg Kellogg
ย 
Introduction to the Web API
Brad Genereaux
ย 
Solr Search Engine: Optimize Is (Not) Bad for You
Sematext Group, Inc.
ย 
Core Java Tutorials by Mahika Tutorials
Mahika Tutorials
ย 
Use Node.js to create a REST API
Fabien Vauchelles
ย 
Building Next-Generation Web APIs with JSON-LD and Hydra
Markus Lanthaler
ย 
Apache Spark 2.0: A Deep Dive Into Structured Streaming - by Tathagata Das
Databricks
ย 
STL in C++
Surya Prakash Sahu
ย 
REST-API introduction for developers
Patrick Savalle
ย 
9. ES6 | Let And Const | TypeScript | JavaScript
pcnmtutorials
ย 
Access specifiers(modifiers) in java
HrithikShinde
ย 
Heap sort
Mohd Arif
ย 

Viewers also liked (20)

PDF
Building Beautiful REST APIs with ASP.NET Core
Stormpath
ย 
PDF
The Ultimate Guide to Mobile API Security
Stormpath
ย 
PPTX
Design Beautiful REST + JSON APIs
Stormpath
ย 
PPTX
Build A Killer Client For Your REST+JSON API
Stormpath
ย 
PDF
Building Beautiful REST APIs in ASP.NET Core
Stormpath
ย 
PPTX
Token Authentication in ASP.NET Core
Stormpath
ย 
PPTX
Custom Data Search with Stormpath
Stormpath
ย 
PDF
JWTs in Java for CSRF and Microservices
Stormpath
ย 
PPTX
Instant Security & Scalable User Management with Spring Boot
Stormpath
ย 
PPTX
Multi-Tenancy with Spring Boot
Stormpath
ย 
PDF
Build a REST API for your Mobile Apps using Node.js
Stormpath
ย 
PPTX
REST API Security: OAuth 2.0, JWTs, and More!
Stormpath
ย 
PPTX
Storing User Files with Express, Stormpath, and Amazon S3
Stormpath
ย 
PPTX
JWTs for CSRF and Microservices
Stormpath
ย 
PDF
Mobile Authentication for iOS Applications - Stormpath 101
Stormpath
ย 
PPTX
Spring Boot Authentication...and More!
Stormpath
ย 
PPTX
Stormpath 101: Spring Boot + Spring Security
Stormpath
ย 
PDF
Getting Started With Angular
Stormpath
ย 
PPTX
Browser Security 101
Stormpath
ย 
PPTX
Secure Your REST API (The Right Way)
Stormpath
ย 
Building Beautiful REST APIs with ASP.NET Core
Stormpath
ย 
The Ultimate Guide to Mobile API Security
Stormpath
ย 
Design Beautiful REST + JSON APIs
Stormpath
ย 
Build A Killer Client For Your REST+JSON API
Stormpath
ย 
Building Beautiful REST APIs in ASP.NET Core
Stormpath
ย 
Token Authentication in ASP.NET Core
Stormpath
ย 
Custom Data Search with Stormpath
Stormpath
ย 
JWTs in Java for CSRF and Microservices
Stormpath
ย 
Instant Security & Scalable User Management with Spring Boot
Stormpath
ย 
Multi-Tenancy with Spring Boot
Stormpath
ย 
Build a REST API for your Mobile Apps using Node.js
Stormpath
ย 
REST API Security: OAuth 2.0, JWTs, and More!
Stormpath
ย 
Storing User Files with Express, Stormpath, and Amazon S3
Stormpath
ย 
JWTs for CSRF and Microservices
Stormpath
ย 
Mobile Authentication for iOS Applications - Stormpath 101
Stormpath
ย 
Spring Boot Authentication...and More!
Stormpath
ย 
Stormpath 101: Spring Boot + Spring Security
Stormpath
ย 
Getting Started With Angular
Stormpath
ย 
Browser Security 101
Stormpath
ย 
Secure Your REST API (The Right Way)
Stormpath
ย 
Ad

Similar to Beautiful REST+JSON APIs with Ion (20)

PDF
Designing a beautiful REST json api
0x07de
ย 
PPTX
The JSON REST API for WordPress
Taylor Lovett
ย 
PDF
ElasticSearch in action
Codemotion
ย 
PPTX
Crafting Evolvable Api Responses
darrelmiller71
ย 
PDF
REST easy with API Platform
Antonio Peric-Mazar
ย 
PDF
Semantic Metastandards will Unlock IoT Interoperability
David Janes
ย 
PDF
JSON REST API for WordPress
Taylor Lovett
ย 
PPTX
JSON-LD for RESTful services
Markus Lanthaler
ย 
PDF
JSON REST API for WordPress
Taylor Lovett
ย 
PDF
Alfresco tech talk live public api episode 64
Alfresco Software
ย 
PPTX
Pragmatic REST: recent trends in API design
Marsh Gardiner
ย 
PPTX
Elasticmeetup curiosity 20141113
Erwan Pigneul
ย 
PDF
Curiosity, outil de recherche open source par PagesJaunes
PagesJaunes
ย 
PPTX
Example-driven Web API Specification Discovery
Javier Canovas
ย 
PPTX
Automatic discovery of Web API Specifications: an example-driven approach
Jordi Cabot
ย 
PDF
IOTDB, Semantics and the Internet of Things
David Janes
ย 
PDF
FIFA fails, Guy Kawasaki and real estate in SF - find out about all three by ...
Elลผbieta Bednarek
ย 
PDF
Real-time Semantic Web with Twitter Annotations
Joshua Shinavier
ย 
PDF
My Journey into the Terrifying World of Hypermedia
Nordic APIs
ย 
PDF
Montreal Elasticsearch Meetup
Loรฏc Bertron
ย 
Designing a beautiful REST json api
0x07de
ย 
The JSON REST API for WordPress
Taylor Lovett
ย 
ElasticSearch in action
Codemotion
ย 
Crafting Evolvable Api Responses
darrelmiller71
ย 
REST easy with API Platform
Antonio Peric-Mazar
ย 
Semantic Metastandards will Unlock IoT Interoperability
David Janes
ย 
JSON REST API for WordPress
Taylor Lovett
ย 
JSON-LD for RESTful services
Markus Lanthaler
ย 
JSON REST API for WordPress
Taylor Lovett
ย 
Alfresco tech talk live public api episode 64
Alfresco Software
ย 
Pragmatic REST: recent trends in API design
Marsh Gardiner
ย 
Elasticmeetup curiosity 20141113
Erwan Pigneul
ย 
Curiosity, outil de recherche open source par PagesJaunes
PagesJaunes
ย 
Example-driven Web API Specification Discovery
Javier Canovas
ย 
Automatic discovery of Web API Specifications: an example-driven approach
Jordi Cabot
ย 
IOTDB, Semantics and the Internet of Things
David Janes
ย 
FIFA fails, Guy Kawasaki and real estate in SF - find out about all three by ...
Elลผbieta Bednarek
ย 
Real-time Semantic Web with Twitter Annotations
Joshua Shinavier
ย 
My Journey into the Terrifying World of Hypermedia
Nordic APIs
ย 
Montreal Elasticsearch Meetup
Loรฏc Bertron
ย 
Ad

More from Stormpath (10)

PPTX
Secure API Services in Node with Basic Auth and OAuth2
Stormpath
ย 
PDF
Securing Web Applications with Token Authentication
Stormpath
ย 
PPTX
Token Authentication for Java Applications
Stormpath
ย 
PPTX
How to Use Stormpath in angular js
Stormpath
ย 
PPTX
Building Secure User Interfaces With JWTs (JSON Web Tokens)
Stormpath
ย 
PPTX
Rest API Security
Stormpath
ย 
PPTX
Elegant Rest Design Webinar
Stormpath
ย 
PPTX
Build a Node.js Client for Your REST+JSON API
Stormpath
ย 
PPTX
So long scrum, hello kanban
Stormpath
ย 
PPTX
REST API Design for JAX-RS And Jersey
Stormpath
ย 
Secure API Services in Node with Basic Auth and OAuth2
Stormpath
ย 
Securing Web Applications with Token Authentication
Stormpath
ย 
Token Authentication for Java Applications
Stormpath
ย 
How to Use Stormpath in angular js
Stormpath
ย 
Building Secure User Interfaces With JWTs (JSON Web Tokens)
Stormpath
ย 
Rest API Security
Stormpath
ย 
Elegant Rest Design Webinar
Stormpath
ย 
Build a Node.js Client for Your REST+JSON API
Stormpath
ย 
So long scrum, hello kanban
Stormpath
ย 
REST API Design for JAX-RS And Jersey
Stormpath
ย 

Recently uploaded (20)

PPTX
ERP - FICO Presentation BY BSL BOKARO STEEL LIMITED.pptx
ravisranjan
ย 
PDF
Why Edge Computing Matters in Mobile Application Tech.pdf
IMG Global Infotech
ย 
PPTX
How Can Recruitment Management Software Improve Hiring Efficiency?
HireME
ย 
PPTX
Iobit Driver Booster Pro 12 Crack Free Download
chaudhryakashoo065
ย 
PPTX
Avast Premium Security crack 25.5.6162 + License Key 2025
HyperPc soft
ย 
PPTX
Android Notifications-A Guide to User-Facing Alerts in Android .pptx
Nabin Dhakal
ย 
PPTX
IObit Driver Booster Pro Crack Download Latest Version
chaudhryakashoo065
ย 
PPTX
IObit Driver Booster Pro 12.4-12.5 license keys 2025-2026
chaudhryakashoo065
ย 
PDF
Cloud computing Lec 02 - virtualization.pdf
asokawennawatte
ย 
PPTX
Quality on Autopilot: Scaling Testing in Uyuni
Oscar Barrios Torrero
ย 
PDF
Automated Test Case Repair Using Language Models
Lionel Briand
ย 
PDF
capitulando la keynote de GrafanaCON 2025 - Madrid
Imma Valls Bernaus
ย 
PDF
AWS Consulting Services: Empowering Digital Transformation with Nlineaxis
Nlineaxis IT Solutions Pvt Ltd
ย 
PDF
Rewards and Recognition (2).pdf
ethan Talor
ย 
PDF
WholeClear Split vCard Software for Split large vCard file
markwillsonmw004
ย 
PPTX
B2C EXTRANET | EXTRANET WEBSITE | EXTRANET INTEGRATION
philipnathen82
ย 
PPTX
IObit Uninstaller Pro 14.3.1.8 Crack Free Download 2025
sdfger qwerty
ย 
PPTX
CV-Project_2024 version 01222222222.pptx
MohammadSiddiqui70
ย 
PPTX
For my supp to finally picking supp that work
necas19388
ย 
PPTX
IDM Crack with Internet Download Manager 6.42 [Latest 2025]
HyperPc soft
ย 
ERP - FICO Presentation BY BSL BOKARO STEEL LIMITED.pptx
ravisranjan
ย 
Why Edge Computing Matters in Mobile Application Tech.pdf
IMG Global Infotech
ย 
How Can Recruitment Management Software Improve Hiring Efficiency?
HireME
ย 
Iobit Driver Booster Pro 12 Crack Free Download
chaudhryakashoo065
ย 
Avast Premium Security crack 25.5.6162 + License Key 2025
HyperPc soft
ย 
Android Notifications-A Guide to User-Facing Alerts in Android .pptx
Nabin Dhakal
ย 
IObit Driver Booster Pro Crack Download Latest Version
chaudhryakashoo065
ย 
IObit Driver Booster Pro 12.4-12.5 license keys 2025-2026
chaudhryakashoo065
ย 
Cloud computing Lec 02 - virtualization.pdf
asokawennawatte
ย 
Quality on Autopilot: Scaling Testing in Uyuni
Oscar Barrios Torrero
ย 
Automated Test Case Repair Using Language Models
Lionel Briand
ย 
capitulando la keynote de GrafanaCON 2025 - Madrid
Imma Valls Bernaus
ย 
AWS Consulting Services: Empowering Digital Transformation with Nlineaxis
Nlineaxis IT Solutions Pvt Ltd
ย 
Rewards and Recognition (2).pdf
ethan Talor
ย 
WholeClear Split vCard Software for Split large vCard file
markwillsonmw004
ย 
B2C EXTRANET | EXTRANET WEBSITE | EXTRANET INTEGRATION
philipnathen82
ย 
IObit Uninstaller Pro 14.3.1.8 Crack Free Download 2025
sdfger qwerty
ย 
CV-Project_2024 version 01222222222.pptx
MohammadSiddiqui70
ย 
For my supp to finally picking supp that work
necas19388
ย 
IDM Crack with Internet Download Manager 6.42 [Latest 2025]
HyperPc soft
ย 

Beautiful REST+JSON APIs with Ion