-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
531 lines (434 loc) · 18.4 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Toward HyperDrupal: Maturing REST on Drupal</title>
<meta name="description" content="An overview of REST and its use in Drupal.">
<meta name="author" content="Ryan Szrama">
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
<link rel="stylesheet" href="css/reveal.min.css">
<link rel="stylesheet" href="css/theme/default.css" id="theme">
<link rel="stylesheet" href="assets/stylesheets/styles.css"> <!-- Just a few changes, not worth a whole theme. -->
<!-- For syntax highlighting -->
<link rel="stylesheet" href="lib/css/zenburn.css">
<!-- If the query includes 'print-pdf', use the PDF print sheet -->
<script>
document.write( '<link rel="stylesheet" href="css/print/' + ( window.location.search.match( /print-pdf/gi ) ? 'pdf' : 'paper' ) + '.css" type="text/css" media="print">' );
</script>
<!--[if lt IE 9]>
<script src="lib/js/html5shiv.js"></script>
<![endif]-->
</head>
<body>
<div class="reveal">
<!-- Any section element inside of this container is displayed as a slide -->
<div class="slides">
<section>
<h1>Toward HyperDrupal</h1>
<h2>Maturing REST on Drupal</h2>
<p>
<small>
Created by <a href="http://www.bywombats.com">Ryan Szrama</a> / <a href="http://twitter.com/ryanszrama">@ryanszrama</a>
</small>
</p>
</section>
<section>
<section>
<h2>1. Introduction</h2>
</section>
<section>
<img src="assets/images/ryan-family.jpg" />
<p>
Ryan Szrama, Community Dev at <a href="http://commerceguys.com">Commerce Guys</a>
</p>
</section>
<section>
<a href="http://www.drupalcommerce.org">
<img src="assets/images/DCLogo_2C_on_black.png" class="simple" />
</a>
<p>So why am I not giving my usual Commerce presentation?</p>
<p>Why talk about REST and Hypermedia?</p>
<aside class="notes">
My interest was piqued when I first researched how to implement a
REST API for a large scale Commerce deployment involving a Commerce
master server that managed transactions for a variety of client
sites. I knew the Services module was a thing, but I'd never used
it or really understood how it facilitated the building of APIs.
</aside>
</section>
<section>
<p>Maybe I'm attracted to constrained systems...</p>
<img src="assets/images/qbasic.gif" class="simple" width="650" />
<a href="http://en.wikipedia.org/wiki/QBasic">http://en.wikipedia.org/wiki/QBasic</a>
<aside class="notes">
I love to see the creativity that arises when people set out to
solve new problems using an abstract set of constraints to guide
their design and development decisions.
</aside>
</section>
<section>
<p>And niche development communities...</p>
<img src="assets/images/allies-and-bridges.jpg" class="simple" />
<a href="http://en.wikipedia.org/wiki/Roguelike">http://en.wikipedia.org/wiki/Roguelike</a>
<aside class="notes">
Because the people in the community are committed to pushing
forward an idea or concept out of passion for their system or
technology.
</aside>
</section>
<section>
<p>
The promise of REST is the API equivalent<br />
of a wiki walk, each response asking,<br />
"Would you like to know (or do) more?"
</p>
<aside class="notes">
Let's talk about what a wiki walk is and what actually makes it possible.
</aside>
</section>
</section>
<!-- Example of nested vertical slides -->
<section>
<section>
<h2>2. The World Wide Web</h2>
<small>
Source: <a href="http://www.crummy.com/writing/speaking/2008-QCon/">http://www.crummy.com/writing/speaking/2008-QCon/</a>
</small>
</section>
<section>
<img src="assets/images/globe.png" class="simple" />
<ul class="rest_buttons">
<li class="fragment">URI</li>
<li class="fragment">HTTP</li>
<li class="fragment">HTML</li>
<li class="last"></li>
</ul>
</section>
<section>
<h2>URI</h2>
<!-- Thanks for sharing the browser image, guys: http://dribbble.com/shots/785555 -->
<img src="assets/images/browser.png" />
<aside class="notes">
Simple, straightforward, but with dependable parts: the protocol,
the host, the path, the fragment, and the query string. Once we
enter a URL, the browser knows how to split it up and work with it.
</aside>
</section>
<section>
<h2>HTTP Request</h2>
<pre>
# Request
GET /page/1 HTTP/1.1
Host: www.example.com
Accept: text/html
</pre>
<aside class="notes">
HTTP is more complex, but its use is standardized - we enforce
constraints on the types of requests and headers, for example.
Thanks to the consistency of client and server implementations,
we can make solid assumptions and optimizations around the protocol.
</aside>
</section>
<section>
<h2>HTML</h2>
<pre>
# Response
HTTP/1.1 200 Ok
Content-Type: text/html;charset=UTF-8
...
<p>This is a wonderful example, no?</p>
<a href="...">See more examples.</a>
...
</pre>
<aside class="notes">
The response is HTML, which is actually hypermedia. It has
"hyperlinks" that my browser knows how to render so I can click on
them if I want to learn more about that that link promises.
And it's not just limited to outbound links - there are also embed
links (images) and "template links" (GET forms). I can also send
instructions that the server can use to create new information
via POST forms, and if I use JavaScript, I can do even more.
</aside>
</section>
<section>
<img src="assets/images/wiki-qbasic.png" />
</section>
<section>
<img src="assets/images/wiki-programming.png" />
</section>
<section>
<img src="assets/images/wiki-programming-paradigms.png" />
</section>
<section>
<img src="assets/images/wiki-external.png" />
</section>
<section>
<img src="assets/images/wiki-external-page.png" />
</section>
<section>
The WWW virtualized and democratized the library<br />
of human knowledge and made it accessible on a<br />
global, distributed network.
<aside class="notes">
But we haven't stopped there. We're using the same technology to
virtualize the office...
</aside>
</section>
<section>
<img src="assets/images/cg-erp.png" />
<aside class="notes">
The government...
</aside>
</section>
<section>
<img src="assets/images/data-gov.png" />
<aside class="notes">
The store...
</aside>
</section>
<section>
<img src="assets/images/conduit.jpg" />
<aside class="notes">
And basically everything else. Everything has an API, and anything
can become a service. So how do we communicate between everything?
</aside>
</section>
</section>
<section>
<section>
<h2>3. HTTP-based APIs</h2>
<small>
Source: <a href="http://nordsc.com/ext/classification_of_http_based_apis.html">http://nordsc.com/ext/classification_of_http_based_apis.html</a>
</small>
</section>
<section>
<h2>XML-RPC / SOAP</h2>
<br />
<p><em>Use HTTP purely as a transport mechanism.</em></p>
<pre>
<?xml version="1.0"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
<soap:Header>
</soap:Header>
<soap:Body>
<m:GetStockPrice xmlns:m="http://www.example.org/stock">
<m:StockName>IBM</m:StockName>
</m:GetStockPrice>
</soap:Body>
</soap:Envelope>
</pre>
<br />
<ul class="rest_buttons rest_features">
<li class="off"><span class="symbol">x</span>URI</li>
<li class="off"><span class="symbol">x</span>HTTP</li>
<li class="off"><span class="symbol">x</span>Hypermedia</li>
<li class="last"></li>
</ul>
</section>
<section>
<p>Why do more?</p>
<iframe width="100%" height="460" src="//www.youtube.com/embed/03T2pKO8ItE?rel=0&theme=dark&modestbranding=1&color=white" frameborder="0" allowfullscreen></iframe>
<img src="http://www.creativemab.com/wp-content/uploads/2011/04/Geris-Game.png" style="display: none;" />
<aside class="notes">
Is anyone familiar with Geri? Geri had a problem - there was no
one around to play against, so he played against himself! However,
if he wanted to, he could have begun a remote game with someone
who understood the rules and perhaps had a chessboard available
to use to keep track of the current state of the game.
</aside>
</section>
<section>
Behold, the SOAP message:
<img src="assets/images/chess.jpg" />
</section>
<section>
<h2>RPC URI-tunneling</h2>
<br />
<em>Idiosyncratic interfaces require extra documentation<br/>
and tightly coupled servers and clients.</em>
<pre>
POST /api/user/1/delete
POST /api/user/1/update
</pre>
<br />
<ul class="rest_buttons rest_features">
<li class="on"><span class="symbol">✔</span>URI</li>
<li class="off"><span class="symbol">x</span>HTTP</li>
<li class="off"><span class="symbol">x</span>Hypermedia</li>
<li class="last"></li>
</ul>
<p></p>
</section>
<section>
<h2>HTTP-based Type I / II</h2>
<br />
<img src="assets/images/notbad.png" class="simple" style="float: right;" >
<p style="text-align: left;">
<em>Use HTTP methods and response codes:</em>
</p>
<pre style="box-shadow: none; width: 70%; margin:0;">
# A Type I message uses a generic media type
GET /api/user/1
Accept: application/json
PUT /api/user/1
DELETE /api/user/1
POST /api/user
# A Type II message is self-descriptive
GET /api/user/1
Accept: application/hal+json
</pre>
<ul class="rest_buttons rest_features" style="clear:both;">
<li class="on"><span class="symbol">✔</span>URI</li>
<li class="on"><span class="symbol">✔</span>HTTP</li>
<li class="off"><span class="symbol">x</span>Hypermedia</li>
<li class="last"></li>
</ul>
</section>
<section>
<h2>REST</h2>
<br />
<p><em>Hypermedia API responses include the controls I need to<br/>navigate or manipulate application resources.</em></p>
<pre>
<maze version="1.0">
<collection href="/maze/maze/">
<link rel="maze" href="/maze/maze/five-by-five/" />
</collection>
</maze>
</pre>
<small>
Source: <a href="http://amundsen.com/media-types/maze/">http://amundsen.com/media-types/maze/</a>
</small>
<ul class="rest_buttons rest_features" style="clear:both;">
<li class="on"><span class="symbol">✔</span>URI</li>
<li class="on"><span class="symbol">✔</span>HTTP</li>
<li class="on"><span class="symbol">✔</span>Hypermedia</li>
<li class="last"></li>
</ul>
</section>
<section>
<h2>The Richardson Maturity Model</h2>
<img src="http://martinfowler.com/articles/images/richardsonMaturityModel/overview.png" />
<small>
Source: <a href="http://martinfowler.com/articles/richardsonMaturityModel.html">http://martinfowler.com/articles/richardsonMaturityModel.html</a>
</small>
</section>
</section>
<section>
<section>
<h2>4. Toward HyperDrupal</h2>
<small>
Follow along: <a href="http://hyperdrupal.org">http://hyperdrupal.org</a>
</small>
</section>
<section>
<h2>Drupal 7 and earlier</h2>
<p>
Using the <a href="http://drupal.org/project/services">Services module</a>, most Drupal based<br />
web services are a combination of RPC URI-Tunneling<br />
and HTTP-based Type I APIs.
</p>
<pre>
# Login is an example of RPC URI-Tunneling
POST /user/login
# While other resources are HTTP-based Type I
GET /user/1
DELETE /node/3
</pre>
</section>
<section>
<h2>Drupal 8</h2>
<p>
Drupal core ships with a REST module that supports:
</p>
<ul class="drupal-8">
<li class="fragment">Entities as resources with unique URIs</li>
<li class="fragment">Representations in different formats</li>
<li class="fragment">Manipulation via the HTTP interface</li>
<li class="fragment last">Self-descriptive messages via <a href="http://stateless.co/hal_specification.html">HAL</a></li>
</ul>
</section>
<section>
<h2>Next Steps</h2>
<p style="text-align: left;">
Next steps involve both education and code:
</p>
<ul class="next-steps">
<li class="fragment">Communicate the constraints and the promise of REST</li>
<li class="fragment">Enrich our (HAL and other) responses with hypermedia</li>
<li class="fragment">Document REST server and client <a href="http://offers.apigee.com/api-design-ebook-rr/">best practices</a></li>
<li class="fragment last">Develop tools that make it even easier</li>
</ul>
<aside class="notes">
Talk about how being a RESTful web service is like Paul Graham's
illustration comparing the startup mentality to that of aspiring
actors.
</aside>
</section>
<section>
<h2>Practical Example</h2>
<p>
Commerce Mobile:
</p>
<img src="assets/images/ck4m-main-final.png" />
</section>
<section>
<p>
The promise of REST is the API equivalent<br />
of a wiki walk, each response asking,<br />
"Would you like to know (or do) more?"
</p>
</section>
<section>
<p>
The opportunity for Drupal is to become<br />
the new <em>de facto</em> solution for building<br />
restful web services.
</p>
</section>
<section
<p>
Help make it happen:
</p>
<p>
<a href="http://drupal.org/project/hyperdrupal">http://drupal.org/project/hyperdrupal</a>
</p>
</section>
</section>
<section>
<h2>Questions?</h2>
<small>
Bibliography / source: <a href="https://github.com/rszrama/toward-hyperdrupal">https://github.com/rszrama/toward-hyperdrupal</a>
</small>
</section>
</div>
</div>
<script src="lib/js/head.min.js"></script>
<script src="js/reveal.min.js"></script>
<script>
// Full list of configuration options available here:
// https://github.com/hakimel/reveal.js#configuration
Reveal.initialize({
controls: true,
progress: true,
history: true,
center: true,
theme: Reveal.getQueryHash().theme, // available themes are in /css/theme
transition: Reveal.getQueryHash().transition || 'default', // default/cube/page/concave/zoom/linear/fade/none
// Optional libraries used to extend on reveal.js
dependencies: [
{ src: 'lib/js/classList.js', condition: function() { return !document.body.classList; } },
{ src: 'plugin/markdown/marked.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: 'plugin/markdown/markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: 'plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } },
{ src: 'plugin/zoom-js/zoom.js', async: true, condition: function() { return !!document.body.classList; } },
{ src: 'plugin/notes/notes.js', async: true, condition: function() { return !!document.body.classList; } }
// { src: 'plugin/search/search.js', async: true, condition: function() { return !!document.body.classList; } }
// { src: 'plugin/remotes/remotes.js', async: true, condition: function() { return !!document.body.classList; } }
]
});
</script>
</body>
</html>