-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathapi.apib
691 lines (408 loc) · 12.4 KB
/
api.apib
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
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
FORMAT: 1A
HOST: https://api.thegrid.io
# The Grid API
# Group User information
## User details [/user]
### Retrieving user information [GET]
+ Response 200 (application/json)
+ Body
```
<!-- include(examples/user-with-avatar.json) -->
```
+ Schema
```
<!-- include(full-schema/user.json) -->
```
# Group Long-running jobs
Several actions in the API takes a significant time.
Current examples include POST /share, /publish and /unpublish.
Performing such an action returns a Location header with a Job URL.
## Job details [/job/{id}]
### Retriving job details [GET]
+ Parameters
+ id (required, string) - Job UUID
+ Response 200 (application/json)
+ Body
```
<!-- include(examples/job-share-completed.json) -->
```
+ Schema
```
<!-- include(full-schema/job.json) -->
```
## Jobs [/job]
### Listing current jobs [GET]
+ Response 200 (application/json)
+ Body
```
[
<!-- include(examples/job-share-completed.json) -->
]
```
# Group Newsfeed
## User's newsfeed [/updates{?offset,limit,measurements}]
### Fetch user's latest newsfeed [GET]
+ Parameters
+ offset (number) - Offset to use for pagination
+ limit (number) - Limit to use for pagination
+ measurements (string) - Selectively get only certain measurements
+ Response 200 (application/json)
+ Body
```
[
<!-- include(examples/item-valid-listing-item.json) -->
]
```
# Group Site Management
## Site information [/site]
### List user websites [GET]
+ Response 200 (application/json)
+ Body
```
[
<!-- include(examples/site-with-config.json) -->
]
```
### Create a website [POST]
+ Request (application/json)
**Note:** the repository must be in `the-domains` organization. The repository name can later be used for sharing content to the newly-created site.
+ Body
```
<!-- include(examples/site-without-owner.json) -->
```
+ Schema
```
<!-- include(full-schema/site.json) -->
```
+ Response 201
Site was successfully created
+ Headers
Location: /site/61a23f6a-d438-49c3-a0b9-7cd5bb0fe177
+ Response 422
Missing site information
+ Body
## User website [/site/{id}]
+ Parameters
+ id (required, string) - Site UUID
### Get website details [GET]
+ Response 200 (application/json)
+ Schema
```
<!-- include(full-schema/site.json) -->
```
### Update website details [PUT]
+ Request (application/json)
+ Body
```
<!-- include(examples/site-without-owner-with-config.json) -->
```
+ Schema
```
<!-- include(full-schema/site.json) -->
```
+ Response 200
### Delete website [DELETE]
+ Response 200
## Site DNS status [/site/{id}/dns]
+ Parameters
+ id (required, string) - Site UUID
### Check website DNS status [POST]
+ Response 200 (application/json)
+ Body
```
{ "valid": true }
```
## Website discovery [/site/discover{?url}]
### Match URL to a website [GET]
+ Parameters
+ url (required, string) - URL of the website
+ Response 302
+ Headers
Location: /site/61a23f6a-d438-49c3-a0b9-7cd5bb0fe177
+ Response 409
Grid site belonging to another user was found at the URL
+ Body
+ Response 404
No Grid site was found for the URL
+ Body
## Redesigns [/site/{id}/redesign{?inflight}]
### Listing redesigns [GET]
Users can request a listing of the current redesigns for a website.
Whenever the site configuration is changed or new content is published, the redesigns list resets to only contain the current live design.
+ Parameters
+ id (required, string) - Site UUID
+ inflight (optional, boolean) - Whether to include in-flight redesigns in the listing
+ Response 200 (application/json)
### Requesting a redesign [POST]
New redesigns can be requested by submitting a rating on an existing design.
+ Parameters
+ id (required, string) - Site UUID
+ Request (application/json)
+ Body
```
<!-- include(examples/redesignrequest-minimal.json) -->
```
+ Schema
```
<!-- include(full-schema/redesignrequest.json) -->
```
+ Response 202
+ Headers
Location: /job/61a23f6a-d438-49c3-a0b9-7cd5bb0fe177
## Redesign [/site/{id}/redesign/{redesign}{?inflight}]
### Individual redesign [GET]
+ Parameters
+ id (required, string) - Site UUID
+ redesign (required, string) - Redesign UUID
+ inflight (optional, boolean) - Whether to include in-flight redesigns in the listing
+ Response 200 (application/json)
### Publish a redesign [POST]
A site can be updated to use any of the redesigns by publishing it. This will trigger a re-solve of the website.
+ Parameters
+ id (required, string) - Site UUID
+ redesign (required, string) - Redesign UUID
+ Response 202
+ Headers
Location: /job/61a23f6a-d438-49c3-a0b9-7cd5bb0fe177
### Delete a redesign [DELETE]
+ Parameters
+ id (required, string) - Site UUID
+ redesign (required, string) - Redesign UUID
+ Response 200
## Redesign Previews [/site/{id}/redesign/{redesign}/preview]
### Showing redesign preview [GET]
+ Parameters
+ id (required, string) - Site UUID
+ redesign (required, string) - Redesign UUID
+ Response 200 (text/html)
## Collaboration [/site/{id}/collaborator]
### Listing collaborators [GET]
Site owner can list the site's collaborators.
+ Parameters
+ id (required, string) - Site UUID
+ Response 200 (application/json)
+ Body
```
[
<!-- include(examples/collaborator-accepted-by-url.json) -->
]
```
### Inviting a new collaborator [POST]
Site owner can invite new collaborators to a site. Collaborators can be invited either by email or by URL of a Grid site.
+ Parameters
+ id (required, string) - Site UUID
+ Request (application/json)
+ Body
```
<!-- include(examples/collaboratorinvite-email.json) -->
```
+ Schema
```
<!-- include(full-schema/collaboratorinvite.json) -->
```
+ Response 201
Collaborator was successfully invited.
+ Body
# Group Content Management
## Share [/share]
### Sharing content [POST]
Users can share content to The Grid. The shared items will be normalized, analyzed and made available via the item API.
Sharing creates a Job, whos progress can be monitored using the /job API.
There are typically two different things you can be sharing:
* Full article pages: share with URL
* HTML fragments: selection or img tag. Share with content, type text/html and with the URL of the originating page
Note that publishing an item to a website is a separate step. See /publish
+ Request (application/json)
+ Body
```
<!-- include(examples/share-url-only.json) -->
```
+ Schema
```
<!-- include(full-schema/share.json) -->
```
+ Response 202
Sharing was successful and will be processed.
+ Headers
Location: /job/b8838e11-1d97-4799-85d8-1aafec52e927
+ Response 422
Missing required parameters
+ Body
+ Response 403
Not allowed to share to the specified website
+ Body
## Upload signing [/share/sign{?objectName,contentType}]
### Signing intent to upload [GET]
In situations where users want to share content from their local filesystem (images, Markdown files, etc), this is done by uploading them to Amazon S3. The share intent signing API provides a temporary upload URL, as well as the permanent URL where the file will reside after upload has completed.
After the file has been uploaded to S3, it can be shared to a Grid site using the normal [share flow](#content-management-share-post).
+ Parameters
+ objectName (string) - Name of the file being uploaded
+ contentType (string) - File MIME type
+ Response 422
Missing required parameters
+ Body
+ Response 200 (application/json)
A temporary upload signature has been generated. Use the provided `signedUrl` to upload via `HTTP PUT`. The `publicUrl` is the URL that the file will have after upload has completed.
+ Body
```
<!-- include(examples/sharesign-response.json) -->
```
## Items list [/item{?published,minimal,offset,limit,site,measurements,blocktype}]
### Retrieve user's content items [GET]
+ Parameters
+ published (boolean) - Whether to get published or unpublished items only
+ minimal (boolean) - Whether to receive items without measurements applied (deprecated, use measurements instead)
+ offset (number) - Offset to use for pagination
+ limit (number) - Limit to use for pagination
+ site (string) - Receive only items associated with given site. Example: the-domains/mywebsite
+ blocktype (string) - Only items containing at least one block of given type
+ measurements (string) - Selectively get only certain measurements
When an item is being worked on by a user it is available via the API. Queries without selective measurements must be paginated. When using pagination, the `limit` must be smaller than 50.
+ Response 200 (application/json)
+ Body
```
[
<!-- include(examples/item-valid-listing-item.json) -->
]
```
### Create an item [POST]
+ Request (application/json)
+ Schema
```
<!-- include(full-schema/item.json) -->
```
+ Body
```
<!-- include(examples/item-valid-general-item.json) -->
```
+ Response 201
+ Headers
Location: /item/b8838e11-1d97-4799-85d8-1aafec52e927
+ Response 422
Missing item information
+ Body
## Item [/item/{id}{?measurements}]
+ Parameters
+ id (required, string) - Item UUID
+ measurements (string) - Selectively get only certain measurements
### Retrieve an item [GET]
+ Response 200 (application/json)
+ Schema
```
<!-- include(full-schema/item.json) -->
```
+ Body
```
<!-- include(examples/item-valid-general-item.json) -->
```
+ Response 404
Item not found
+ Body
### Update item [PUT]
+ Request (application/json)
+ Schema
```
<!-- include(full-schema/item.json) -->
```
+ Body
```
<!-- include(examples/item-valid-general-item.json) -->
```
+ Response 200 (application/json)
Item was successfully updated.
+ Body
+ Response 422
Missing item information
+ Body
### Update item metadata [PATCH]
+ Response 204
Item was successfully updated
+ Body
+ Response 422
Missing item information
+ Body
### Remove item [DELETE]
+ Response 200
## Publishing [/publish]
### Publish a items to a site [POST]
+ Request (application/json)
+ Body
```
<!-- include(examples/publish-with-sites.json) -->
```
+ Schema
```
<!-- include(full-schema/publish.json) -->
```
+ Response 202
+ Headers
Location: /job/61a23f6a-d438-49c3-a0b9-7cd5bb0fe177
## Unpublishing [/unpublish]
### Unpublish items from a site [POST]
+ Request (application/json)
+ Body
```
<!-- include(examples/publish-with-sites.json) -->
```
+ Schema
```
<!-- include(full-schema/publish.json) -->
```
+ Response 202
+ Headers
Location: /job/61a23f6a-d438-49c3-a0b9-7cd5bb0fe177
## Copying [/copy/{id}]
+ Parameters
+ id (required, string) - Item UUID
### Copy an item [POST]
+ Request
+ Schema
```
<!-- include(full-schema/copymove.json) -->
```
+ Response 200
Item was successfully copied. New item location can be found from the location header.
+ Headers
Location: /item/61a23f6a-d438-49c3-a0b9-7cd5bb0fe177
+ Response 422
Missing item information
+ Body
## Moving [/move/{id}]
+ Parameters
+ id (required, string) - Item UUID
### Move an item to another site [POST]
+ Request
+ Schema
```
<!-- include(full-schema/copymove.json) -->
```
+ Response 200
Item was successfully moved.
+ Headers
Location: /item/61a23f6a-d438-49c3-a0b9-7cd5bb0fe177
+ Response 422
Missing item information
+ Body
## Reordering items [/reorder/item]
### Reorder an items list [POST]
+ Request
+ Body
```
<!-- include(examples/reorderitems-valid-two-items.json) -->
```
+ Schema
```
<!-- include(full-schema/reorderitems.json) -->
```
+ Response 200
Items were successfully reordered.
+ Body
```
[
"bdcc6765-114a-4184-977d-b01d3132ef69",
"b04d3a7f-689f-4bc5-a7c6-304b39f271f3"
]
```
+ Response 422
Missing item information
+ Body