-
Notifications
You must be signed in to change notification settings - Fork 2
/
cs_rest_api_swagger_v3.yaml
1545 lines (1397 loc) · 38.3 KB
/
cs_rest_api_swagger_v3.yaml
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
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
openapi: 3.0.0
servers:
- url: 'https://helx.commonsshare.org/'
info:
title: CommonsShare API
description: A web interface and web service API for sharing data and running workflows on data in a cloud-agnostic environment.
version: 0.1.2
termsOfService: https://helx.commonsshare.org/terms-of-use/
contact:
name: Hong Yi
email: [email protected]
tags:
- name: NIHdatacommons
- name: Helx
- name: CommonsShare
- name: Portals
- name: WebServices
paths:
'/django_irods/rest_download/{path}':
get:
description: |-
download a resource bag or file
:param request:
:param path:
:param args:
:param kwargs:
:return:
parameters:
- description: ''
required: true
name: path
in: path
schema:
type: string
tags:
- django_irods
summary: download a resource bag or file
operationId: rest_download_read
responses:
'200':
description: OK
/dosapi/dataobjects/:
get:
description: >-
Get a list of data objects based on the following filter query
parameters
REST URL: dosapi/dataobjects/
HTTP method: GET
Supported query parameters (all are optional):
:type owner: str
:type from_date: str (e.g., 2015-04-01)
:type to_date: str (e.g., 2015-05-01)
:param owner: (optional) - to get a list of resources owned by a
specified username
:param from_date: (optional) - to get a list of resources created on or
after this date
:param to_date: (optional) - to get a list of resources created on or
before this date
:rtype: json string
:return: a paginated list of resources with data for resource id,
title, resource type,
creator, public, date created, date last updated, resource bag url path,
and science
metadata url path
example return JSON format for GET /dosapi/dataobjects/:
{ "count":n
"next": link to next page
"previous": link to previous page
"results":[
{"resource_id": resource id,
"date_last_updated": date resource last updated,
"public": true or false,
"resource_url": link to resource landing HTML page,
]
}
parameters:
- description: A page number within the paginated result set.
required: false
name: page
in: query
schema:
type: integer
tags:
- dosapi
summary: >-
Get a list of data objects based on the following filter query
parameters
operationId: dataobjects_list
responses:
'200':
description: OK
'/dosapi/dataobjects/{id}/':
get:
description: |-
Get a dataobject in json format
:param request:
:param pk:
:return:
parameters:
- description: ''
required: true
name: id
in: path
schema:
type: string
tags:
- dosapi
summary: Get a dataobject in json format
operationId: dataobjects_read
responses:
'200':
description: OK
/hsapi/_internal/data-store-move-to-folder/:
post:
description: >-
Move a list of files and/or folders to another folder in a resource file
hierarchy.
:param request: a REST request
:param pk: the short_id of a resource to modify, from REST URL.
It is invoked by an AJAX call and returns a json object that has the
relative paths of
the target files or folders to which files have been moved. The AJAX
request must be a POST
request with input data passed in for source_paths and target_path where
source_paths
and target_path are the relative paths for the source and target file or
folder in the
res_id file directory.
This routine is **specifically** targeted at validating requests from
the UI.
Thus it is much more limiting than a general purpose REST responder.
tags:
- hsapi
summary: >-
Move a list of files and/or folders to another folder in a resource file
hierarchy.
operationId: _internal_data-store-move-to-folder_create
responses:
'201':
description: Created
/hsapi/_internal/data-store-rename-file-or-folder/:
post:
description: >-
Rename one file or folder in a resource file hierarchy. It is invoked
by an AJAX call
:param request: a REST request
:param pk: the short_id of a resource to modify, from REST URL.
This is invoked by an AJAX call in the UI. It returns a json object that
has the
relative path of the target file or folder that has been renamed. The
AJAX request
must be a POST request with input data for source_path and target_path,
where source_path
and target_path are the relative paths for the source and target file or
folder.
This routine is **specifically** targeted at validating requests from
the UI.
Thus it is much more limiting than a general purpose REST responder.
tags:
- hsapi
summary: >-
Rename one file or folder in a resource file hierarchy. It is invoked
by an AJAX call
operationId: _internal_data-store-rename-file-or-folder_create
responses:
'201':
description: Created
'/hsapi/_internal/{shortkey}/rest-download-refts-resource-bag/':
get:
description: |-
Download a reference time series resource bag
:param request:
:param shortkey: resource uuid
:param args:
:param kwargs:
:return:
parameters:
- description: ''
required: true
name: shortkey
in: path
schema:
type: string
tags:
- hsapi
summary: Download a reference time series resource bag
operationId: _internal_rest-download-refts-resource-bag_list
responses:
'200':
description: OK
/hsapi/dictionary/universities/:
get:
description: |-
Return a list of all vocabulary items
:return:
tags:
- hsapi
summary: Return a list of all vocabulary items
operationId: dictionary_universities_list
responses:
'200':
description: OK
/hsapi/resource/:
get:
description: |-
List existing resources
:param request:
:return:
parameters:
- description: A page number within the paginated result set.
required: false
name: page
in: query
schema:
type: integer
tags:
- hsapi
summary: List existing resources
operationId: resource_list
responses:
'200':
description: OK
post:
description: |-
Create a new resource
:param request:
:return:
tags:
- hsapi
summary: Create a new resource
operationId: resource_create
responses:
'201':
description: Created
requestBody:
$ref: '#/components/requestBodies/resource_createData'
'/hsapi/resource/accessRules/{id}/':
put:
description: |-
Update access rules for a resource
:param request:
:param pk: resource uuid
:return:
parameters:
- description: ''
required: true
name: id
in: path
schema:
type: string
tags:
- hsapi
summary: Update access rules for a resource
operationId: resource_accessRules_update
responses:
'200':
description: OK
/hsapi/resource/types/:
get:
description: >-
Get a list of resource types
REST URL: hsapi/resourceTypes
HTTP method: GET
example return JSON format for GET /hsapi/resourceTypes (note response
will consist of only
one page):
[
{
"resource_type": "GenericResource"
},
{
"resource_type": "RasterResource"
},
{
"resource_type": "RefTimeSeries"
},
{
"resource_type": "TimeSeriesResource"
},
{
"resource_type": "NetcdfResource"
},
{
"resource_type": "ModelProgramResource"
},
{
"resource_type": "ModelInstanceResource"
},
{
"resource_type": "ToolResource"
},
{
"resource_type": "SWATModelInstanceResource"
}
]
parameters:
- description: A page number within the paginated result set.
required: false
name: page
in: query
schema:
type: integer
tags:
- hsapi
summary: Get a list of resource types
operationId: resource_types_list
responses:
'200':
description: OK
'/hsapi/resource/{id}/':
get:
description: |-
Get a resource in zipped BDBag format
:param request:
:param pk:
:return:
parameters:
- description: ''
required: true
name: id
in: path
schema:
type: string
tags:
- hsapi
summary: Get a resource in zipped BDBag format
operationId: resource_read
responses:
'200':
description: OK
put:
description: |-
Update a resource bag (to be implemented)
:param request:
:param pk:
:return:
parameters:
- description: ''
required: true
name: id
in: path
schema:
type: string
tags:
- hsapi
summary: Update a resource bag (to be implemented)
operationId: resource_update
responses:
'200':
description: OK
requestBody:
$ref: '#/components/requestBodies/resource_createData'
delete:
description: |-
Delete a resource
:param request:
:param pk:
:return:
parameters:
- description: ''
required: true
name: id
in: path
schema:
type: string
tags:
- hsapi
summary: Delete a resource
operationId: resource_delete
responses:
'204':
description: No Content
'/hsapi/resource/{id}/access/':
get:
description: |-
Retrieve access permission for a resource
:param request:
:param pk: resource uuid
:return:
parameters:
- description: ''
required: true
name: id
in: path
schema:
type: string
- description: A page number within the paginated result set.
required: false
name: page
in: query
schema:
type: integer
tags:
- hsapi
summary: Retrieve access permission for a resource
operationId: resource_access_list
responses:
'200':
description: OK
put:
description: |-
Update access permission for a resource
:param request:
:param pk: resource uuid
:return:
parameters:
- description: ''
required: true
name: id
in: path
schema:
type: string
tags:
- hsapi
summary: Update access permission for a resource
operationId: resource_access_update
responses:
'200':
description: OK
requestBody:
content:
application/json:
schema:
required:
- privilege
type: object
properties:
privilege:
type: string
description: ''
delete:
description: |-
Delete access permission for a resource
:param request:
:param pk: resource uuid
:return:
parameters:
- description: ''
required: true
name: id
in: path
schema:
type: string
tags:
- hsapi
summary: Delete access permission for a resource
operationId: resource_access_delete
responses:
'204':
description: No Content
'/hsapi/resource/{id}/copy/':
post:
description: |-
Copy a resource
:param request:
:param pk: resource uuid
:return:
parameters:
- description: ''
required: true
name: id
in: path
schema:
type: string
tags:
- hsapi
summary: Copy a resource
operationId: resource_copy_create
responses:
'201':
description: Created
'/hsapi/resource/{id}/file_list/':
get:
description: |-
Get a listing of files within a resource.
:param request:
:param pk: Primary key of the resource (i.e. resource short ID)
:return:
parameters:
- description: ''
required: true
name: id
in: path
schema:
type: string
- description: A page number within the paginated result set.
required: false
name: page
in: query
schema:
type: integer
tags:
- hsapi
summary: Get a listing of files within a resource.
operationId: resource_file_list_list
responses:
'200':
description: OK
post:
description: |-
Add a file to a resource.
:param request:
:param pk: Primary key of the resource (i.e. resource short ID)
:return:
parameters:
- description: ''
required: true
name: id
in: path
schema:
type: string
tags:
- hsapi
summary: Add a file to a resource.
operationId: resource_file_list_create
responses:
'201':
description: Created
requestBody:
content:
application/json:
schema:
required:
- url
- size
- content_type
type: object
properties:
url:
type: string
description: ''
content_type:
type: string
description: ''
size:
type: integer
description: ''
'/hsapi/resource/{id}/files/':
get:
description: |-
Get a listing of files within a resource.
:param request:
:param pk: Primary key of the resource (i.e. resource short ID)
:return:
parameters:
- description: ''
required: true
name: id
in: path
schema:
type: string
- description: A page number within the paginated result set.
required: false
name: page
in: query
schema:
type: integer
tags:
- hsapi
summary: Get a listing of files within a resource.
operationId: resource_files_list
responses:
'200':
description: OK
'/hsapi/resource/{id}/files/{pathname}/':
get:
description: |-
Retrieve a resource file
:param request:
:param pk:
:param pathname:
:return:
parameters:
- description: ''
required: true
name: pathname
in: path
schema:
type: string
- description: ''
required: true
name: id
in: path
schema:
type: string
tags:
- hsapi
summary: Retrieve a resource file
operationId: resource_files_read
responses:
'200':
description: OK
post:
description: >-
Add a file to a resource.
:param request:
:param pk: Primary key of the resource (i.e. resource short ID)
:param pathname: the path to the containing folder in the folder
hierarchy
:return:
Leaving out pathname in the URI calls a different class function in
ResourceFileListCreate
that stores in the root directory instead.
parameters:
- description: ''
required: true
name: pathname
in: path
schema:
type: string
- description: ''
required: true
name: id
in: path
schema:
type: string
tags:
- hsapi
summary: Add a file to a resource.
operationId: resource_files_create
responses:
'201':
description: Created
put:
description: |-
Retrieve, add, update or delete a resource file
REST URL: hsapi/resource/{pk}/files/{filename}
HTTP method: GET
:type pk: str
:type filename: str
:param pk: resource id
:param filename: name of the file to retrieve/download
:return: resource file data
:rtype: file data bytes
REST URL: POST hsapi/resource/{pk}/files/
parameters:
- description: ''
required: true
name: pathname
in: path
schema:
type: string
- description: ''
required: true
name: id
in: path
schema:
type: string
tags:
- hsapi
summary: 'Retrieve, add, update or delete a resource file'
operationId: resource_files_update
responses:
'200':
description: OK
delete:
description: |-
Delete a resource file
:param request:
:param pk:
:param pathname:
:return:
parameters:
- description: ''
required: true
name: pathname
in: path
schema:
type: string
- description: ''
required: true
name: id
in: path
schema:
type: string
tags:
- hsapi
summary: Delete a resource file
operationId: resource_files_delete
responses:
'204':
description: No Content
'/hsapi/resource/{id}/flag/':
post:
description: |-
Set resource flag
:param request:
:param pk: resource uuid
:return:
parameters:
- description: ''
required: true
name: id
in: path
schema:
type: string
tags:
- hsapi
summary: Set resource flag
operationId: resource_flag_create
responses:
'201':
description: Created
'/hsapi/resource/{id}/folders/{pathname}/':
get:
description: list a given folder
parameters:
- description: ''
required: true
name: pathname
in: path
schema:
type: string
- description: ''
required: true
name: id
in: path
schema:
type: string
tags:
- hsapi
summary: list a given folder
operationId: resource_folders_read
responses:
'200':
description: OK
put:
description: create a given folder if not present and allowed
parameters:
- description: ''
required: true
name: pathname
in: path
schema:
type: string
- description: ''
required: true
name: id
in: path
schema:
type: string
tags:
- hsapi
summary: create a given folder if not present and allowed
operationId: resource_folders_update
responses:
'200':
description: OK
delete:
description: Delete a folder.
parameters:
- description: ''
required: true
name: pathname
in: path
schema:
type: string
- description: ''
required: true
name: id
in: path
schema:
type: string
tags:
- hsapi
summary: Delete a folder.
operationId: resource_folders_delete
responses:
'204':
description: No Content
'/hsapi/resource/{id}/functions/move-or-rename/':
post:
description: |-
Move or rename a resource file or folder
:param request:
:param pk: resource uuid
:return:
parameters:
- description: ''
required: true
name: id
in: path
schema:
type: string
tags:
- hsapi
summary: Move or rename a resource file or folder
operationId: resource_functions_move-or-rename_create
responses:
'201':
description: Created
'/hsapi/resource/{id}/functions/set-file-type/{file_path}/{hs_file_type}/':
post:
description: >-
Set file type as specified by *hs_file_type* using the file given by
*file_path*
:param request: an instance of HttpRequest object
:param pk: id of the composite resource in which this file type needs to
be set
:param file_path: relative file path of the file which needs to be set
to the specified file
type. If the absolute file path is
[resource-id]/data/some-folder/some-file.txt then
file_path needs to be set as: some-folder/some-file.txt
:param hs_file_type: type of file to be set (e.g, NetCDF, GeoRaster,
GeoFeature etc)
:return:
parameters:
- description: ''
required: true
name: file_path
in: path
schema:
type: string
- description: ''
required: true
name: id
in: path
schema:
type: string
- description: ''
required: true
name: hs_file_type
in: path
schema:
type: string
tags:
- hsapi
summary: >-
Set file type as specified by *hs_file_type* using the file given by
*file_path*
operationId: resource_functions_set-file-type_create
responses:
'201':
description: Created
'/hsapi/resource/{id}/functions/unzip/{pathname}/':
post:
description: |-
Public version of data_store_folder_unzip, incorporating path variables
:param request:
:param pk: resource uuid
:param pathname: path to the zip file to be unzipped
:return HttpResponse:
parameters:
- description: ''
required: true
name: pathname
in: path
schema:
type: string
- description: ''
required: true
name: id
in: path
schema:
type: string
tags:
- hsapi
summary: 'Public version of data_store_folder_unzip, incorporating path variables'
operationId: resource_functions_unzip_create
responses:
'201':
description: Created
'/hsapi/resource/{id}/functions/zip/':
post:
description: |-
Zip a folder in a resource
:param request:
:param pk: resource uuid
:return:
parameters:
- description: ''
required: true
name: id
in: path
schema:
type: string
tags:
- hsapi
summary: Zip a folder in a resource
operationId: resource_functions_zip_create
responses:
'201':
description: Created
'/hsapi/resource/{id}/map/':
get:
description: |-
Retrieve resource map
REST URL: hsapi/resource/{pk}/map
HTTP method: GET
:type pk: str