forked from zooniverse/panoptes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
apiary.apib
5623 lines (4476 loc) · 174 KB
/
apiary.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
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
FORMAT: 1A
HOST: https://panoptes-staging.zooniverse.org/api
# Panoptes API
Panoptes API is a *crowdsourcing system* based on serving _subjects_,
images or other media, to _volunteers_ and asking them to _classify_
the _subject_ based on a defined _workflow_ for the _subject_ type.
# Naming Conventions
Resources attributes related to human readable names for resources
follow a common convention.
+ name - the url_escaped, downcased, and underscored unique identifier that can be used to construct client URLs
+ display_name - a non-unique identifier that can contain any character. Used to quickly describe a resource.
+ title - a non-unique identifier that can contain any character. Maybe translated if a client requests a representation of a resource in another language
# Authentication
Panoptes API provides an OAuth 2.0 authentication mechanism. (TODO:
Describe Authentication Workflow).
# Headers
Panoptes API sometime requires specific headers to be sent as part of requests.
All requests should set `Accept: application/vnd.api+json; version=1`. You will receive a `404 Not Found` without it.
All PUT and POST requests should set `Content-Type: application/vnd.api+json; version=1` or `Content-Type: application/json`. You will receive a `415 Unsupported Media Type` without one of those two headers.
All PUT and DELETE requests should set the `If-Match` header to the value of the `ETag` header of the request where the resource was originally retrieved. You will receive a `428 Precondition Required` without the header and a `412 Precondition Failed` if the etags do not match.
# Group Panoptes API Root [/]
Panoptes API entry point.
This resource does not have attributes instead it lists links to the
available resources.
## Retrieve Entry Point [GET]
+ Request
+ Headers
Accept: application/vnd.api+json; version=1
Content-Type: application/json
+ Response 200
+ Body
{
"links": {
"subjects": "/subjects",
"users": "/users",
"projects": "/projects",
"workflows": "/workflows",
"subject_sets": "/subject_sets",
"groups": "/user_groups",
"classifications": "/classifications",
"memberships": "/memberships",
"collections": "/collections",
"subject_queues": "/subject_queues",
"project_roles": "/project_roles",
"project_preferences": "/project_preferences",
"workflow_contents": "/workflow_contents",
"project_contents": "/project_contents"
}
}
# Group User
Resources related to _Panotpes Users_.
## User [/users/{id}]
A single User object. A User is representation of the identity and
contributions of a volunteer.
The User resource has the following attributes:
- id
- created_at
- updated_at
- credited_name
- login
- display_name
- email
- zooniverse_id
- classifications_count
- languages
*id*, *zooniverse_id*, *created_at*, *updated_at*, and
*classification_count* are created and updated by the Panoptes API.
+ Parameters
+ id (integer) ... ID of the User as an integer key
+ Model
+ Body
{
"links": {
"users.projects": {
"href": "/projects?owner={users.owner_name}",
"type": "projects"
},
"users.user_groups": {
"href": "/user_groups?user_id={users.id}",
"type": "user_groups"
},
"users.subjects": {
"href": "/subjects?user_id={users.id}",
"type": "subjects"
},
"users.collections": {
"href": "/collections?owner={users.owner_name}",
"type": "collections"
}
},
"users": [{
"id": 1,
"created_at": "2014-03-20T00:15:47Z",
"updated_at": "2013-09-30T10:20:32Z",
"credited_name": "Dr. Stuart Lynn",
"login": "stuart",
"display_name": "Stuart",
"owner_name": "stuart",
"email": "[email protected]",
"zooniverse_id": "123432",
"classifications_count": "104",
"languages": ["en-gb", "es-mx"]
}]
}
### Retrieve a single User [GET]
The *email* attribute is only available if the requesting user is an
administrator or the user resource being requested is that of the
requesting user.
+ Request
+ Headers
Accept: application/vnd.api+json; version=1
Content-Type: application/json
+ Response 200
[User][]
### Edit a single User [PUT]
The currently logged in User may edit their record by sending a
partial representation of the resource including their changes. A User
cannot edit linked resources.
+ Request
+ Headers
Accept: application/vnd.api+json; version=1
Content-Type: application/json
+ Body
{
"users": {
"credited_name": "Dr. Stuart Lynn, DDS"
}
}
+ Response 200
[User][]
### Destroy a single User [DELETE]
The current logged in User may delete themself. This does not fully
remove the user resource; instead, it deactivates their projects
and removes personally identifying information including the
*credited_name* and *email* address.
+ Response 204
## Users Collection [/users{?page,page_size,sort,include}]
Collection of all Users
All collections add a *meta* attribute hash containing
paging information.
User resources are included a an array under the _users_ key
+ Model
JSON-API formatted respresentation of the Users collection
+ Headers
Accept: application/vnd.api+json; version=1
Content-Type: application/json
+ Body
{
"links": {
"users.projects": {
"href": "/projects?owner={users.owner_name}",
"type": "projects"
},
"users.user_groups": {
"href": "/user_groups?user_id={users.id}",
"type": "user_groups"
},
"users.subjects": {
"href": "/subjects?user_id={users.id}",
"type": "subjects"
},
"users.collections": {
"href": "/collections?owner={users.owner_name}",
"type": "collections"
}
},
"meta": {
"users": {
"page": 1,
"page_size": 2,
"count": 28,
"include": [],
"page_count": 14,
"previous_page": 14,
"next_page": 2,
"first_href": "/users?page_size=2",
"previous_href": "/users?page=14page_size=2",
"next_href": "/users?page=2&page_size=2",
"last_href": "/users?page=14&page_size=2"
}
},
"users": [{
"id": 1,
"created_at": "2014-03-20T00:15:47Z",
"updated_at": "2013-09-30T10:20:32Z",
"created_name": "Dr. Stuart Lynn",
"login": "stuart",
"display_name": "Stuart",
"email": "[email protected]",
"zooniverse_id": "123432",
"classifications_count": "104",
"languages": ["en-gb", "es-mx"],
},
{
"id": 2,
"created_at": "2014-03-20T00:15:47Z",
"updated_at": "2013-09-30T10:20:32Z",
"created_name": "Dr. Stuart Lynn",
"login": "stuart",
"display_name": "Stuart",
"email": "[email protected]",
"zooniverse_id": "123432",
"classifications_count": "104",
"languages": ["en-gb", "es-mx"],
}]
}
### List all Users [GET]
+ Parameters
+ page (optional, integer) ... index of the collection page, 1 is default
+ page_size (optional, integer) ... number of items on a page. 20 is default
+ sort (optional, string) ... fields to sort collection by. id is default
+ include (optional, string) ... comma separated list of linked resources to include
+ Request
+ Headers
Accept: application/vnd.api+json; version=1
Content-Type: application/json
+ Response 200
[Users Collection][]
# Group Classification
Resources related to _Pantopes Classifications_.
## Classification [/classification/{id}]
A single Classification resource object. This represents a _user's_
responses to a _worflow's_ questions about a _subject_.
A classifications has the following attributes:
- id
- created_at
- updated_at
- completed
- metadata
- gold_standard
- annotations
Annotations is an array of maps of the form `{ "task": "task_key",
"value": "question answer" }`. Metadata contains additional information about a
classification including:
- started_at
- finished_at
- user_agent
- workflow_version
- user_language
+ Model
+ Body
{
"links": {
"classifications.user": {
"href": "/users/{classifications.user}",
"type": "classifications"
},
"classifications.project": {
"href": "/projects/{classifications.project}",
"type": "projects"
},
"classifications.workflow": {
"href": "/workflows/{classification.workflow}",
"type": "workflows"
},
"classifications.subject": {
"href": "/subjects/{classifications.subjects}",
"type": "subjects"
}
},
"classifications": [{
"id": 1001,
"created_at": "2014-08-24T22:24:32Z",
"updated_at": "2014-08-24T22:24:32Z",
"completed": false,
"metadata": {
"started_at": "2014-08-24T22:20:21Z",
"finished_at": "2014-08-24T22:24:31Z",
"user_agent": "cURL",
"user_language": "es_MX",
"workflow_version": "11.12"
},
"annotations": [
{
"task": "task-1",
"value": [10.4, 12.4, 13.2]
}
],
"links": {
"user": "1",
"subjects": ["10"],
"workflow": "81",
"project": "2"
}
}]
}
### Retrieve a single Classification [GET]
A User may retrieve any classification, irrespective of the complete status.
+ Request
+ Headers
Accept: application/vnd.api+json; version=1
Content-Type: application/json
+ Response 200
[Classification][]
### Edit a single Classification [PUT]
A User may modify an incomplete classification. It should be marked as
completed when done.
The *annotations* attributes must be returned as a full representation
of the annotations array.
+ Request
+ Headers
Accept: application/vnd.api+json; version=1
Content-Type: application/json
+ Body
{
"classifications": {
"annotations": [
{
"task": "task-1",
"value": [10.4, 12.4, 13.2]
},
{
"task": "workflow-2",
"value": "fishy"
}
],
"completed": true
}
}
+ Response 200
[Classification][]
### Destroy a single Classification [DELETE]
A User may delete an incomplete classification.
+ Request
+ Headers
Accept: application/vnd.api+json; version=1
Content-Type: application/json
+ Response 204
## Classification Collection [/classifications{?page,page_size,sort,project_id,user_group_id,include,for}]
A representation of all the Classifications in a collection
All collections add a *meta* attribute hash containing
paging information.
Classifications are returned as an array under the _classifications_
key.
+ Model
A JSON API formatted respresentation of a collection of
classification resources
+ Body
{
"links": {
"classifications.user": {
"href": "/users/{classifications.user}",
"type": "classifications"
},
"classifications.project": {
"href": "/projects/{classifications.project}",
"type": "projects"
},
"classifications.workflow": {
"href": "/workflows/{classification.workflow}",
"type": "workflows"
},
"classifications.subject": {
"href": "/subjects/{classifications.subjects}",
"type": "subjects"
}
},
"meta": {
"classifications": {
"page": 1,
"page_size": 2,
"count": 28,
"include": [],
"page_count": 14,
"previous_page": 14,
"next_page": 2,
"first_href": "/classifications?page_size=2",
"previous_href": "/classifications?page=14page_size=2",
"next_href": "/classifications?page=2&page_size=2",
"last_href": "/classifications?page=14&page_size=2"
}
},
"classifications": [{
"id": 1001,
"created_at": "2014-08-24T22:24:32Z",
"updated_at": "2014-08-24T22:24:32Z",
"completed": false,
"metadata": {
"started_at": "2014-08-24T22:20:21Z",
"finished_at": "2014-08-24T22:24:31Z",
"user_agent": "cURL",
"user_language": "es_MX",
"workflow_version": "11.12"
},
"annotations": [
{
"task": "task-1",
"value": [10.4, 12.4, 13.2]
}
],
"links": {
"user": "1",
"subjects": ["10"],
"workflow": "81",
"project": "2"
}
},
{
"id": 1002,
"created_at": "2014-08-24T22:25:32Z",
"updated_at": "2014-08-24T22:28:32Z",
"completed": true,
"metadata": {
"started_at": "2014-08-24T22:24:21Z",
"finished_at": "2014-08-24T22:28:31Z",
"user_agent": "cURL",
"user_language": "es_MX",
"workflow_version": "11.12"
},
"annotations": [
{
"task": "task-1",
"value": [10.4, 12.4, 13.2]
},
{
"task": "task-2",
"value": "workflow-2": "starry"
}
],
"links": {
"user": "1",
"subjects": ["11"],
"workflow": "81",
"project": "2"
}
}]
}
### List all classifications [GET]
Only lists classifications the active user has made or projects the user has edit permissions for.
Classifications have special collection routes that indicate the scope you would like to retrieve.
Possible options are:
+ '/' default, will fetch the current user's past complete classifications.
+ '/incomplete' will fetch the current user's past incomplete classifications.
+ '/project' will fetch classifications from projects a user has 'edit' permissions for
+ '/gold_standard' will fetch gold standard classifications for all marked workflows
Any of the scopes may be further filtered using the *project_id*, *workflow_id*
and *user_group_id* parameters.
+ Parameters
+ page (optional, integer) ... index of the collection page, 1 is default
+ page_size (optional, integer) ... number of items on a page. 20 is default
+ sort (optional, string) ... fields to sort collection by. updated_at is default
+ project_id (optional, integer) ... only retrieve classifications for a specific project
+ user_group_id (optional, integer) ... only retrieve classifications for a specific user group
+ include (optional, string) ... comma separated list of linked resources to return with the collection
+ last_id (optional, integer) ... only classifications with ids greater than `last_id` will be returned
(`/project` only, requires project_id)
+ Request
+ Headers
Accept: application/vnd.api+json; version=1
Content-Type: application/json
+ Response 200
[Classification Collection][]
### Create a Classification [POST]
Create a classification by providing a JSON-API formatted object, that
must include _metadata_, _annotations_ and a _links_ hash. Optionally, it
may include the _completed_ field, which if not included defaults to true.
The completed field is used to store half-completed classifications, so the user
can later continue from where they stopped.
The _links_ hash must contain a _subjects_ hash, a _project_ and a _workflow_.
The _metadata_ hash must contain all the keys specified in the example.
Please note, the _workflow_version_ should be the value returned from the
specific workflow representation. The annotations array must be in the
format specified in the example, i.e. an array of objects, containing a _task_ and a _value_.
The _task_ can be anything and must not necessarily align with the tasks of the workflow
(even though that is generally not advised).
+ Request
+ Headers
Accept: application/vnd.api+json; version=1
Content-Type: application/json
+ Body
{
"classifications": {
"completed": false,
"metadata": {
"started_at": "2014-08-24T22:20:21Z",
"finished_at": "2014-08-24T22:24:31Z",
"user_agent": "cURL",
"user_language": "es_MX",
"workflow_version": "11.12"
},
"annotations": [
{ "task": "task-name",
"value": "Any type: string, hash, array, etc" }
],
"links": {
"subjects": ["11"],
"workflow": "81",
"project": "2"
}
}
}
+ Response 201
[Classification][]
# Group Subjects
Resources related to _Panoptes Subjects_.
## Subject [/subjects/{id}{?include}]
A single Subject object. A Subject is a resource that describe a
piece of media to be classified including metadata about the object.
- id
- zooniverse_id
- created_at
- updated_at
- locations
- metadata
*id*, *zooniverse_id*, *created_at*, and *updated_at* are assigned by
the API.
+ Parameters
+ id (required, integer) ... integer id of the subject resource
+ Model
+ Body
{
"links": {
"subjects.project": {
"href": "/projects/subjects.project",
"type": "projects"
},
"subjects.subject_sets": {
"href": "/subject_sets/subjects.subject_sets",
"type": "subject_sets"
}
},
"subjects": [{
"id": "1",
"zooniverse_id": "AGFS0001231",
"created_at": "2014-03-24T10:42:21Z",
"updated_at": "2014-03-24T10:42:21Z",
"locations": [
{"image/jpeg": "http://s3.amazonaws.com/subjects/1.png"}
],
"metadata": {
"lens_type": "50mm"
},
"links": {
"project": "1",
"subject_sets": ["1"]
}
}]
}
### Retrieve a single Subject [GET]
+ Request
+ Headers
Accept: application/vnd.api+json; version=1
Content-Type: application/json
+ Response 200
[Subject][]
### Edit a single Subject [PUT]
Users are permitted to edit subjects belonging to projects a user
has edit permissions for. A user may not change the project of a
subject.
The *locations* array should have the mime-types of the subject's
associated media. The response will contain signed s3 urls the client
may make a PUT request containing the media to. The signed urls will
be valid for 20 minutes.
A request chagning the *metadata* hash must contain a full
representation of the attribute.
+ Request
+ Headers
Accept: application/vnd.api+json; version=1
Content-Type: application/json
+ Body
{
"subjects": {
"locations": [
"image/png"
]
}
}
+ Response 200
[Subject][]
### Destroy a single subject [DELETE]
Users are permitted to destroy a subjects they own or
subjects belongs to a project a user has destroy permissions for.
+ Request
+ Headers
Accept: application/vnd.api+json; version=1
Content-Type: application/json
+ Response 204
## Subject Version [/subjects/{subject_id}/versions/{id}]
A Subject Version resource represents a set of changes made to
a Subject resource.
It has the following attributes:
- id
- changset
- whodunnit
- created_at
It is not editable.
+ Parameters
+ subject_id (required, integer) ... id of the subject to retreive versions for
+ id (required, integer) ... integer id of the version to load
+ Model
+ Body
{
"versions": [{
"id": "43",
"changeset": {
"metadata": [{
"ra": "20.2",
"dec": "12.4"
},{
"ra": "21.1",
"dec": "11.1"
}]
},
"whodunnit": "stuartlynn",
"created_at": "2014-03-20T06:23:12Z",
"links": {
"item": {
"id": "101",
"href": "/subject/101",
"type": "subjects"
}
}
}]
}
### Retrieve a Single Version [GET]
+ Request
+ Headers
Accept: application/vnd.api+json; version=1
Content-Type: application/json
+ Response 200
[Subject Version][]
## Subject Version Collection [/subjects/{subject_id}/versions{?page_size,page}]
A collection of Subject Version resources.
All collections add a meta attribute hash containing paging
information.
Subject Versions are returned as an array under *versions*.
+ Parameters
+ subject_id (required, integer) ... id of the subject to retreive versions for
+ Model
+ Body
{
"meta": {
"versions": {
"page": 1,
"page_size": 2,
"count": 28,
"include": [],
"page_count": 14,
"previous_page": 14,
"next_page": 2,
"first_href": "/subjects/101/versions?page_size=2",
"previous_href": "/subjects/101/versions?page=14page_size=2",
"next_href": "/subjects/101/versions/?page=2&page_size=2",
"last_href": "/subjects/101/versions?page=14&page_size=2"
}
},
"versions": [{
"id": "42",
"changeset": {
"metadata": [{
"ra": "120.2",
"dec": "-12.4"
},{
"ra": "121.1",
"dec": "-11.1"
}]
},
"whodunnit": "stuartlynn",
"created_at": "2014-03-20T06:23:12Z",
"links": {
"item": {
"id": "101",
"href": "/subject/101",
"type": "subjects"
}
}
},{
"id": "43",
"changeset": {
"metadata": [{
"ra": "20.2",
"dec": "12.4"
},{
"ra": "21.1",
"dec": "11.1"
}]
},
"whodunnit": "stuartlynn",
"created_at": "2014-03-20T06:23:12Z",
"links": {
"item": {
"id": "101",
"href": "/subject/101",
"type": "subjects"
}
}
}]
}
### List all Subject Versions [GET]
+ Parameters
+ page (optional, integer) ... the index of the page to retrieve default is 1
+ page_size (optional, integer) ... number of items to include on a page default is 20
+ Request
+ Headers
Accept: application/vnd.api+json; version=1
Content-Type: application/json
+ Response 200
[Subject Version Collection][]
## Subject Collection [/subjects{?page,page_size,sort,workflow_id,subject_set_id}]
Represents a collection of subjects.
All collections add a *meta* attribute hash containing paging information.
Subjects are returned as an array under the _subject_ key.
+ Model
+ Body
{
"links": {
"subjects.project": {
"href": "/projects/subjects.project",
"type": "projects"
},
"subjects.subject_sets": {
"href": "/subject_sets/subjects.subject_sets",
"type": "subject_sets"
}
},
"meta": {
"subjects": {
"page": 1,
"page_size": 2,
"count": 28,
"include": [],
"page_count": 14,
"previous_page": 14,
"next_page": 2,
"first_href": "/subjects?page_size=2",
"previous_href": "/subjects?page=14page_size=2",
"next_href": "/subjects?page=2&page_size=2",
"last_href": "/subjects?page=14&page_size=2"
}
},
"subjects": [{
"id": "1",
"zooniverse_id": "AGFS0001231",
"created_at": "2014-03-24T10:42:21Z",
"updated_at": "2014-03-24T10:42:21Z",
"locations": [
{"image/jpeg": "http://s3.amazonaws.com/subjects/1.png"}
],
"metadata": {
"lens_type": "50mm"
},
"links": {
"project": "1"
"subject_sets": ["1"]
}
},{
"id": "2",
"zooniverse_id": "AGFS0001232",
"created_at": "2014-03-24T10:44:21Z",
"updated_at": "2014-03-24T10:44:21Z",
"locations": [
{"image/jpeg": "http://s3.amazonaws.com/subjects/2.png"}
],
"metadata": {
"lens_type": "50mm"
},
"links": {
"project": "1"
"subject_sets": ["1"]
}
}]
}
### Retrieve a List of Subjects [GET]
Subjects allow a special sort option called 'cellect' that produces a
list of subjects that have not been seen by the active user.
When the cellect sort is used, *workflow_id* is a required parameter.
Subjects also allow an 'queued' sort, which will return a random
subset of subjects have a been queued for a particular user to
classify, usually for expert classifiers.
+ Parameters
+ page (optional, integer) ... the index of the page to retrieve default is 1
+ page_size (optional, integer) ... number of items to include on a page default is 20
+ sort (optional, string) ... field to sort by 'queued' have special behaviour
+ workflow_id (optional, integer) ... filter to subjects belonging to a specific workflow, it is a required param when sort is 'queued'.
+ subject_set_id (optional, integer) ... return subjects belonging to the identified subject_set, it is required when sort is 'queued' and the workflow is grouped.
+ Request
+ Headers
Accept: application/vnd.api+json; version=1
Content-Type: application/json
+ Response 200
[Subject Collection][]
### Create a Subject [POST]
A *locations* attribute and a project link are required.
To have the Zooniverse host your media resources the *locations* array
should have the mime-types of the subject's associated media,
e.g `"locations":["image/png", "image/jpg", "image/png"]`,
note the locations mime types are stored in order.
The create response will contain signed s3 urls the client may make a PUT
request containing the media to. The signed urls will be valid for 20 minutes.
Please take the order of the returned s3 urls into account when PUT'ing
local media resources to the remote location.
To use your own hosted media resources the *locations* array
should be comprised of objects that represent the mime-type and the hosted URL
of the subject's associated media,
e.g. `"locations":[
{"image/png": "https://your.s3_account.com/subjects/1.png"},
{"image/jpg": "https://your.s3_account.com/subjects/1.jpg"}
]`.
The *metadata* attribute is optional.
+ Request
+ Headers
Accept: application/vnd.api+json; version=1
Content-Type: application/json
+ Body
{