This repository has been archived by the owner on May 10, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
/
oada-api.raml
824 lines (784 loc) · 31.6 KB
/
oada-api.raml
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
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
#%RAML 0.8
# Copyright 2014 Open Ag Data Alliance
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
---
title: Open Ag Data Alliance
version: v0.3
baseUri: https://{rootUri}/{version}
baseUriParameters:
rootUri:
description: |
The root URI for a particular implementation of OADA. This *MUST*
include a domain and *MAY* include a path to allow coexistence with
other REST APIs.
example: api.oada.io, api.oada.io/OADA
documentation:
- title: Overview
content: |
The OADA API is intended to serve as a specification for all
providers that desire to be OADA compliant. This API does not
attempt to define or enforce a single industry data standard. The
goal of this API is to enable interoperability between the many
precision ag software systems and existing industry data types. By
providing an extensible API that focuses on information exchange
and facilitates data transformations, an open heterogeneous
environment that supports many legacy, current, and future data
formats can be embraced.
- title: Readme
content: !include README.md
- title: License
content: !include LICENSE
protocols: [ HTTPS ]
#schemas:
securitySchemes:
- oauth_2_0:
description: |
OADA supports OAuth 2.0 for authenticating all API requests.
type: OAuth 2.0
describedBy:
headers:
Authorization: &authorization
description: |
Used to send a valid OAuth 2 access token.
example: |
Authorization: Bearer 0b79bab50daca910b000d4f1a2b675d604257e42
responses:
401: &resp401
description: |
Bad or expired token. This can happen if the token
expired. To fix, you should re-authenticate the
user.
403: &resp403
description: |
Bad OAuth request (wrong consumer key, bad nonce,
expired timestamp...). Unfortunately,
re-authenticating the user won't help here.
settings:
authorizationUri: https://{rootUri}/oauth2/authorize
accessTokenUri: https://{rootUri}/oauth2/token
authorizationGrants: [ token ]
resourceTypes: !include resource-types.raml
traits:
- paginated:
queryParameters:
offset:
type: integer
default: 0
minimum: 0
description: |
The collection index of the first item in this page.
example: 20
limit:
type: integer
default: <<defaultLimit>>
minimum: 1
description: |
The number of items from the collection in this page.
example: 10
responses:
400:
- filterable:
queryParameters:
q:
type: string
required: false
description: |
TODO: The exact format of search queries is still under
development.
example:
responses:
400:
- expandable:
queryParameters:
_expand:
type: boolean
default: false
description: |
Expand all document href properties to their actual
resource.
responses:
400:
/resources:
type: collection
description: |
Explore and manage resources in the data storage.
get:
description: |
Returns a paginated collection of all resources owned by the
currently authenticated user. The results can be limited by an
optional query parameter filter.
is: [ paginated: {defaultLimit: 100}, filterable ]
responses:
200:
body:
application/json:
example: !include examples/resources/resources.get.json
post:
description: |
Uploads a new resource and returns the resulting document.
headers:
Content-Disposition:
queryParameters:
derivativeOf: &derivativeOf
type: string
description: |
Optional parameter. If included it must be a valid href to
the resource of which the data is a derivative of. The
OADA implementation will automatically add the new resource
to the referenced resources derivative list.
example: https://openag.io/resources/d3jcds9
body:
multipart/form-data: &formUpload
formParameters:
blob:
type: file
required: true
description: |
The data blob to be uploaded.
/{resourceId}:
type: instance
description: |
Add, edit, and delete resources in storage.
uriParameters:
resourceId:
type: string
description: |
The id of this resource in the data storage.
get:
description: |
Returns the contents of the given resource.
responses:
200:
body:
application/json:
example: !include examples/resources/resources-id.get.json
head:
description: |
Returns the headers for the given resource.
put:
description: |
Creates or Updates a resource with given resource id.
headers:
Content-Disposition:
responses:
200:
body:
application/json:
example: !include examples/resources/resources-id.get.json
body:
multipart/form-data: *formUpload
patch:
description: |
Patches a resource with given resource id.
headers:
Content-Disposition:
responses:
200:
body:
application/json:
example: !include examples/resources/resources-id.get.json
delete:
description: |
Deletes the specified resource and its associated data.
responses:
404:
/_id:
type: informational
get:
description: |
Returns the id corresponding to this resource.
/_meta:
type: datum
description: |
Document of metadata associated with the resource's data.
get:
description: |
Returns the value of the given _meta data key.
responses:
200:
body:
application/json:
example: !include examples/resources/resources-id-meta.get.json
404:
put:
description: |
Creates or Updates the value of the given _meta data key.
responses:
200:
body:
application/json:
example: !include examples/resources/resources-id-meta.get.json
201:
body:
application/json:
example: !include examples/resources/resources-id-meta.get.json
patch:
description: |
Patches the value of the given _meta data key.
responses:
200:
body:
application/json:
example: !include examples/resources/resources-id-meta.get.json
head:
description: |
Returns the headers for the given resource's _meta data.
responses:
404:
/{key}:
type: instance
description: |
Create, Update, and Delete the values of the given key.
uriParameters:
key:
type: string
description: |
Key in the given resource data keystore.
get:
description: |
Returns the value of the given key.
put:
description:
Updates or Creates a value under the given key. If the
key already exists, the original value will be lost.
body:
multipart/form-data: *formUpload
post:
description: |
Adds a single or set of key-value pairs to the store.
body:
application/json:
schema: !!null
delete:
description: |
Deletes the given key and its value.
/formats:
type: informational
get:
description: |
Returns a collection of resource formats that the given
resource can be returned as.
is: [ paginated : {defaultLimit: 100}, filterable, expandable ]
body:
application/json:
schema: !!null
responses:
200:
body:
application/json:
example: !include examples/resources/resources-id-formats.get.json
/changes:
type: informational
get:
description: |
Returns a collection of changes to this resource and all of
the resources in its tree of children.
queryParameters:
lastChangeId:
type: string
description: |
Optional. If provided the returned list of changes
starts with the change directly following the given
id.
is: [ paginated : {defaultLimit: 100}, filterable, expandable ]
responses:
200:
body:
application/json:
example: !include examples/resources/resources-id-changes.get.json
/parents:
type: collection
description: |
Add, remove, and list directories that are parents to the
given directory.
get:
description: |
Returns a paginated collection of all directories that are
parents to the given directory. The results can be limited
by an optional query parameter filter.
is: [ paginated : {defaultLimit: 100}, filterable ]
responses:
200:
body:
application/json:
example: !include examples/resources/resources-id-parents.get.json
post:
description: |
Adds a parent directory to the given directory.
body:
application/json:
schema: !!null
responses:
201:
body:
application/json:
example: !include examples/resources/resources-id-parents-id.get.json
/{parentId}:
type: reference
uriParameters:
parentId:
type: string
description: |
The id of a folder resource containing this
resource.
get:
responses:
200:
body:
application/json:
example: !include examples/resources/resources-id-parents-id.get.json
/children:
type: collection
description: |
Add, remove, and list directories that are parents to the
given directory.
get:
description: |
Returns a paginated collection of all directories that are
children of the given directory. The results can be limited
by an optional query parameter filter.
is: [ paginated : {defaultLimit: 100}, filterable ]
responses:
200:
body:
application/json:
example: !include examples/resources/resources-id-children.get.json
post:
description: |
Adds a child directory to the given directory.
body:
application/json:
schema: !!null
responses:
201:
body:
application/json:
example: !include examples/resources/resources-id-children-id.get.json
/{childId}:
type: reference
get:
description: |
Returns a document describing the given child.
responses:
200:
body:
application/json:
example: !include examples/resources/resources-id-children-id.get.json
/permissions:
type: collection
description: |
Add, remove, and list sharing permissions of this resource.
There are three permission levels:
- owner
- reader
- writer
There are four permission types:
- user - local user id
- domain - all users of a particular identity provider
- anyone - publicly available
- group - user created grouping of other users (`/groups`)
get:
description: |
Returns a paginated collection of all permissions associated
with the given directory. The results can be limited
by an optional query parameter filter.
is: [ paginated : {defaultLimit: 100}, filterable ]
responses:
200:
body:
application/json:
example: !include examples/resources/resources-id-permissions.get.json
post:
description: |
Creates a permission for this resource.
responses:
201:
body:
application/json:
example: !include examples/resources/resources-id-permissions-id.get.json
/{permissionId}:
type: datum
get:
description: |
Returns the permission document associated with the
given permission id.
responses:
200:
body:
application/json:
example: !include examples/resources/resources-id-permissions-id.get.json
404:
put:
description: |
Creates or Updates a permission document associated with
the given permission id.
responses:
200:
body:
application/json:
example: !include examples/resources/resources-id-permissions-id.get.json
201:
body:
application/json:
example: !include examples/resources/resources-id-permissions-id.get.json
404:
patch:
description: |
Updates a permission document associated with
the given permission id.
responses:
200:
body:
application/json:
example: !include examples/resources/resources-id-permissions-id.get.json
404:
/syncs:
type: collection
description: |
Set up synchronization between a resource on two different OADA
compliant implementations. Push notifications or polling can be
used.
get:
description: |
Returns a paginated collection of all syncs associated
with the given resource. The results can be limited
by an optional query parameter filter.
is: [ paginated : {defaultLimit: 100}, filterable ]
responses:
200:
body:
application/json:
example: !include examples/resources/resources-id-syncs.get.json
post:
description: |
Creates a sync for this resource.
responses:
201:
body:
application/json:
example: !include examples/resources/resources-id-syncs-id_poll.get.json
/{syncId}:
type: datum
get:
description: |
Returns the sync document associated with the given
resource/sync id.
responses:
200:
body:
application/json:
example: !include examples/resources/resources-id-syncs-id_push.get.json
404:
put:
description: |
Creates or Updates a sync document associated with the
given resources/syncn id.
responses:
200:
body:
application/json:
example: !include examples/resources/resources-id-syncs-id_poll.get.json
201:
body:
application/json:
example: !include examples/resources/resources-id-syncs-id_push.get.json
404:
patch:
description: |
Updates a sync document associated with the given
resource/sync id.
responses:
200:
body:
application/json:
example: !include examples/resources/resources-id-syncs-id_push.get.json
404:
/derivatives:
type: collection
description: |
Add, remove, and list resources that are derivatives of this
resource.
get:
description: |
Returns a paginated collection of all the resources that are
derivatives to the given resource. The results can be
limited by an optional query parameter filter.
is: [ paginated : {defaultLimit: 100}, filterable ]
responses:
200:
body:
application/json:
example: !include examples/resources/resources-id-derivatives.get.json
post:
description: |
Adds a derivative to the given resource.
body:
application/json:
schema: !!null
responses:
201:
body:
application/json:
example: !include examples/resources/resources-id-derivatives-id.get.json
/{derivativeId}:
type: reference
uriParameters:
derivativeId:
type: string
description: |
The id of a particular derivative for this
resource.
get:
responses:
200:
body:
application/json:
example: !include examples/resources/resources-id-derivatives-id.get.json
/bookmarks:
type: collection
description: |
Explore and manage farm bookmark data such as fields, machines,
etc. Eventually this data will help directly query resources.
get:
description: |
Returns a paginated collection of all bookmarks for the
currently authenticated user. The results can be limited by an
optional query parameter filter.
is: [ paginated: {defaultLimit: 100}, filterable ]
responses:
200:
body:
application/json:
example: !include examples/configs/configs.get.json
post:
description: |
Creates one or more new keys.
body:
application/json:
schema: !!null
responses:
201:
body:
application/json:
example: !include examples/configs/configs.get.json
/{bookmarkKey}: &_bookmarkKey
type: datum
description: |
Custom key heirachy that resloves a resource that is the
bookmark.
get:
description: |
Returns the key resource.
responses:
200:
body:
application/json:
example: !include examples/configs/configs-id.get.json
404:
put:
description: |
Creates or Updates the given bookmark key
body:
application/json:
schema: !!null
responses:
200:
body:
application/json:
example: !include examples/configs/configs-id.get.json
201:
body:
application/json:
example: !include examples/configs/configs-id.get.json
patch:
description: |
Updates the given key.
body:
application/json:
schema: !!null
responses:
200:
body:
application/json:
example: !include examples/configs/configs-id.get.json
404:
delete:
description: |
Deletes the specified key.
responses:
404:
/about:
type: informational
description: |
A document that describes the current user and session.
get:
responses:
200:
body:
application/json:
example: !include examples/about/about.get.json
/users:
type: collection
description: |
The list of all users known to the current user.
get:
responses:
200:
body:
application/json:
example: !include examples/users/users.get.json
post:
responses:
201:
body:
application/json:
example: !include examples/users/users.get.json
/{userId}:
type: datum
description: |
A document describing various information about a given user.
get:
responses:
200:
body:
application/json:
example: !include examples/users/users-id.get.json
put:
responses:
200:
body:
application/json:
example: !include examples/users/users-id.get.json
201:
body:
application/json:
example: !include examples/users/users-id.get.json
patch:
responses:
200:
body:
application/json:
example: !include examples/users/users-id.get.json
/groups:
type: collection
description: |
The list of all groups defined by the current user.
get:
responses:
200:
body:
application/json:
example: !include examples/groups/groups.get.json
post:
responses:
201:
body:
application/json:
example: !include examples/groups/groups.get.json
/{groupId}:
type: datum
description: |
A document listing the users in a given group.
get:
responses:
200:
body:
application/json:
example: !include examples/groups/groups-id.get.json
put:
responses:
200:
body:
application/json:
example: !include examples/groups/groups-id.get.json
201:
body:
application/json:
example: !include examples/groups/groups-id.get.json
patch:
responses:
200:
body:
application/json:
example: !include examples/groups/groups-id.get.json
/authorizations:
type: collection
description: |
The list of all active authorizations, e.g., tokens, for the current
user.
get:
responses:
200:
body:
application/json:
example: !include examples/authorizations/authorizations.get.json
post:
responses:
201:
body:
application/json:
example: !include examples/authorizations/authorizations.get.json
/{authorizationId}:
type: datum
description: |
A document describing the details of a particular authorization.
For example: assignee, scope, expiration time, etc.
get:
responses:
200:
body:
application/json:
example: !include examples/authorizations/authorizations-id.get.json
put:
responses:
200:
body:
application/json:
example: !include examples/authorizations/authorizations-id.get.json
201:
body:
application/json:
example: !include examples/authorizations/authorizations-id.get.json
patch:
responses:
200:
body:
application/json:
example: !include examples/authorizations/authorizations-id.get.json
/.well-known:
/oada-configuration:
type: informational
description: |
JSON document used to discover the specific implementation's OADA
configuration.
See [RFC5785][RFC].
[RFC]: http://www.ietf.org/rfc/rfc5785.txt "RFC5785"
get:
responses:
200:
body:
application/json:
example: !include examples/well-known/oada-configuration.get.json
/openid-configuration:
type: informational
description: |
Defined in [OpenID Connect Discovery 1.0][openid].
[openid]: http://openid.net/specs/openid-connect-discovery-1_0.html#WellKnownContents "OpenID Connect Discovery 1.0"
get:
responses:
200:
body:
application/json:
example: !include examples/well-known/openid-configuration.get.json