forked from bukalapak/snowboard
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path13. Named Endpoints.html
489 lines (378 loc) · 14.5 KB
/
13. Named Endpoints.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
<!DOCTYPE html>
<html lang="en">
<head>
<title>Named Endpoints API</title>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.2.4/semantic.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/prism/1.5.1/themes/prism-okaidia.min.css" />
<style>
blockquote {
border-left: solid 4px #eee;
padding-left: 8px;
font-style: italic;
margin-left: 0;
padding: 8px;
}
.ui.micro.label {
font-size: .25rem;
}
.ui.transaction.accordion .title {
text-align: center;
}
.ui.transaction.accordion .content {
border-top: solid 1px #ddd !important;
border-bottom: solid 1px #ddd !important;
background-color: rgba(0,0,0,.03);
padding: 0.5em 1em !important;
}
.ui.transaction.accordion .content.active {
margin-top: 0.5em;
}
.ui.basic.label {
text-align: left;
overflow: auto;
}
.ui.basic.label.request-url {
user-select: text;
}
.resource .ui.sub.header {
text-transform: none;
}
@media only screen and (min-width: 768px) {
.sidewrap {
margin-right: 2rem;
}
.sidenav {
left: 0;
top: 0;
width: inherit;
position: fixed !important;
height: 100% !important;
overflow-y: auto !important;
padding-left: 0.5rem;
}
}
</style>
</head>
<body>
<div class="ui padded grid">
<div class="sidewrap four wide computer five wide tablet sixteen wide mobile column">
<div class="sidenav">
<div class="ui horizontal divider">
<a href="#introduction">Introduction</a>
</div>
<div class="ui fluid secondary vertical menu">
<a class="item" href="#introduction">Named Endpoints API</a>
</div>
<div class="ui horizontal divider">
<a href="#quick-start">Quick start</a>
</div>
<div class="ui accordion fluid">
<div class="title active">
<i class="dropdown icon"></i>
<strong>Create message</strong>
</div>
<div class="content active">
<div class="ui fluid secondary vertical menu">
<a class="item blue" href="#quick-start-create-message-create-message">
<i class="ui blue empty circular label"></i>
<span>Create message</span>
</a>
</div>
</div>
<div class="title ">
<i class="dropdown icon"></i>
<strong>Create a new task</strong>
</div>
<div class="content ">
<div class="ui fluid secondary vertical menu">
<a class="item blue" href="#quick-start-create-a-new-task-create-a-new-task">
<i class="ui blue empty circular label"></i>
<span>Create a new task</span>
</a>
</div>
</div>
</div>
</div>
</div>
<div class="eleven wide computer ten wide tablet sixteen wide mobile column">
<div class="ui hidden divider header"></div>
<h1 class="ui huge header" id="introduction">Named Endpoints API</h1>
<hr class="ui divider">
<div class="description">
<p>This API example demonstrates how to define a standalone endpoint with an identifier.</p>
<h2 id="api-blueprint">API Blueprint</h2>
<ul>
<li><p><a href="12.%20Advanced%20Action.md">Previous: Advanced Action</a></p></li>
<li><p><a href="https://raw.github.com/apiaryio/api-blueprint/master/examples/13.%20Named%20Endpoints.md">This: Raw API Blueprint</a></p></li>
<li><p><a href="14.%20JSON%20Schema.md">Next: JSON Schema</a></p></li>
</ul>
</div>
<div class="ui hidden divider"></div>
<div class="ui horizontal divider" id="quick-start">
Quick start
</div>
<div class="ui header center aligned">
<div class="ui header">
<div class="sub header">
</div>
</div>
</div>
<div class="ui stacked segments">
<div class="ui basic segment resource">
<div class="ui purple huge ribbon label">
Create message
</div>
<div class="ui header">
<div class="ui sub header">
</div>
</div>
</div>
<div class="ui grey horizontal small divider header">
<i class="ui grey micro circular label"></i>
<i class="ui pink micro circular label"></i>
<i class="ui grey micro circular label"></i>
</div>
<div class="ui basic segment">
<h3 class="ui block center aligned header" id="quick-start-create-message-create-message">
Create message
</h3>
<div class="description"><p>Start out by creating a message for the world to see.</p>
</div>
<h4 class="ui horizontal divider">
REQUEST
</h4>
<div class="description"></div>
<div class="fluid ui large labeled button">
<div class="ui blue large button">
<h3>POST</h3>
</div>
<a class="ui basic fluid request-url blue label">
<code>/messages</code>
</a>
</div>
<table class="ui celled definition table">
<thead>
<tr>
<th colspan="2">Headers</th>
</tr>
</thead>
<tbody>
<tr>
<td class="four wide">Content-Type</td>
<td><code>application/json</code></td>
</tr>
</tbody>
</table>
<div class="ui stacked segment">
<div class="ui fluid transaction accordion">
<div class="title">
<code>application/json</code>
</div>
<div class="content tabbed">
<div class="ui top attached tabular menu">
<a data-tab="body" class="active item">BODY</a>
<a data-tab="schema" class="item">SCHEMA</a>
</div>
<div class="ui bottom attached active tab segment" data-tab="body">
<pre style="white-space: inherit">
<code class="language-json">{ "message": "Hello World!" }
</code>
</pre>
</div>
<div class="ui bottom attached tab segment" data-tab="schema">
<pre style="white-space: inherit">
<code class="language-json"></code>
</pre>
</div>
</div>
</div>
</div>
<h4 class="ui horizontal divider">RESPONSE</h4>
<div class="description"></div>
<table class="ui celled definition table">
<thead>
<tr>
<th colspan="2">Headers</th>
</tr>
</thead>
<tbody>
<tr>
<td class="four wide">Location</td>
<td><code>/messages/1337</code></td>
</tr>
</tbody>
</table>
<div class="ui stacked blue segment">
<div class="ui fluid transaction accordion">
<div class="title center aligned">
<a class="ui blue circular label">
201
</a>
<code></code>
</div>
<div class="content tabbed">
<div class="ui top attached tabular menu">
<a data-tab="body" class="active item">BODY</a>
<a data-tab="schema" class="item">SCHEMA</a>
</div>
<div class="ui bottom attached active tab segment" data-tab="body">
<pre style="white-space: inherit">
<code class="language-"></code>
</pre>
</div>
<div class="ui bottom attached tab segment" data-tab="schema">
<pre style="white-space: inherit">
<code class="language-json"></code>
</pre>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="ui hidden divider"></div>
<div class="ui stacked segments">
<div class="ui basic segment resource">
<div class="ui purple huge ribbon label">
Create a new task
</div>
<div class="ui header">
<div class="ui sub header">
</div>
</div>
</div>
<div class="ui grey horizontal small divider header">
<i class="ui grey micro circular label"></i>
<i class="ui pink micro circular label"></i>
<i class="ui grey micro circular label"></i>
</div>
<div class="ui basic segment">
<h3 class="ui block center aligned header" id="quick-start-create-a-new-task-create-a-new-task">
Create a new task
</h3>
<div class="description"><p>Now create a task that you need to do at a later date.</p>
</div>
<h4 class="ui horizontal divider">
REQUEST
</h4>
<div class="description"></div>
<div class="fluid ui large labeled button">
<div class="ui blue large button">
<h3>POST</h3>
</div>
<a class="ui basic fluid request-url blue label">
<code>/tasks</code>
</a>
</div>
<table class="ui celled definition table">
<thead>
<tr>
<th colspan="2">Headers</th>
</tr>
</thead>
<tbody>
<tr>
<td class="four wide">Content-Type</td>
<td><code>application/json</code></td>
</tr>
</tbody>
</table>
<div class="ui stacked segment">
<div class="ui fluid transaction accordion">
<div class="title">
<code>application/json</code>
</div>
<div class="content tabbed">
<div class="ui top attached tabular menu">
<a data-tab="body" class="active item">BODY</a>
<a data-tab="schema" class="item">SCHEMA</a>
</div>
<div class="ui bottom attached active tab segment" data-tab="body">
<pre style="white-space: inherit">
<code class="language-json">{
"name": "Exercise in gym",
"done": false,
"type": "task"
}
</code>
</pre>
</div>
<div class="ui bottom attached tab segment" data-tab="schema">
<pre style="white-space: inherit">
<code class="language-json"></code>
</pre>
</div>
</div>
</div>
</div>
<h4 class="ui horizontal divider">RESPONSE</h4>
<div class="description"></div>
<table class="ui celled definition table">
<thead>
<tr>
<th colspan="2">Headers</th>
</tr>
</thead>
<tbody>
<tr>
<td class="four wide">Location</td>
<td><code>/tasks/1992</code></td>
</tr>
</tbody>
</table>
<div class="ui stacked blue segment">
<div class="ui fluid transaction accordion">
<div class="title center aligned">
<a class="ui blue circular label">
201
</a>
<code></code>
</div>
<div class="content tabbed">
<div class="ui top attached tabular menu">
<a data-tab="body" class="active item">BODY</a>
<a data-tab="schema" class="item">SCHEMA</a>
</div>
<div class="ui bottom attached active tab segment" data-tab="body">
<pre style="white-space: inherit">
<code class="language-"></code>
</pre>
</div>
<div class="ui bottom attached tab segment" data-tab="schema">
<pre style="white-space: inherit">
<code class="language-json"></code>
</pre>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="ui hidden divider"></div>
</div>
</div>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.3.1/components/accordion.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.3.1/components/tab.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.3.1/components/transition.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.3.1/components/popup.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.13.0/prism.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.13.0/components/prism-json.min.js"></script>
<script type="text/javascript">
$(function() {
$('.ui.accordion').accordion({ animateChildren: false, duration: 0 });
$('.content.tabbed').each(function(index) {
$('.ui.tabular .item', $(this)).tab({ context: $(this) });
});
$('.ui.vertical.menu').on('click', '.item', function() {
$('.ui.vertical.menu .item').removeClass('active');
$(this).addClass('active');
});
$('.ui.empty.circular.label').popup();
});
</script>
</body>
</html>