This repository has been archived by the owner on Jun 30, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathswagger.json
15208 lines (15208 loc) · 929 KB
/
swagger.json
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
{
"swagger": "2.0",
"info": {
"title": "Introduction",
"version": "",
"description": "The APIv3 is a hypermedia REST API, a shorthand for \"Hypermedia As The Engine Of Application State\" (HATEOAS).\nThis means that each endpoint of this API will have links to other resources or actions defined in the resulting body.\n\nThese related resources and actions for any given resource will be context sensitive. For example, only actions that the\nauthenticated user can take are being rendered. This can be used to dynamically identify actions that the user might take for any\ngiven response.\n\nAs an example, if you fetch a work package through the [Work Package endpoint](#work-packages), the `update` link will only\nbe present when the user you authenticated has been granted a permission to update the work package in the assigned project.\n\n## HAL+JSON\n\nHAL is a simple format that gives a consistent and easy way to hyperlink between resources in your API.\nRead more in the following specification: https://tools.ietf.org/html/draft-kelly-json-hal-08\n\n**OpenProject API implementation of HAL+JSON format** enriches JSON and introduces a few meta properties:\n\n- `_type` - specifies the type of the resource (e.g.: WorkPackage, Project)\n - `_links` - contains all related resource and action links available for the resource\n - `_embedded` - contains all embedded objects\n\nHAL does not guarantee that embedded resources are embedded in their full representation, they might as well be\npartially represented (e.g. some properties can be left out).\nHowever in this API you have the guarantee that whenever a resource is **embedded**, it is embedded in its **full representation**.\n\n## API response structure\n\nAll API responses contain a single HAL+JSON object, even collections of objects are technically represented by\na single HAL+JSON object that itself contains its members. More details on collections can be found\nin the [Collections Section](#collections).\n\n# Authentication\n\nThe API supports the following authentication schemes: OAuth2, session based authentication, and basic auth.\n\nDepending on the settings of the OpenProject instance many resources can be accessed without being authenticated.\nIn case the instance requires authentication on all requests the client will receive an **HTTP 401** status code\nin response to any request.\n\nOtherwise unauthenticated clients have all the permissions of the anonymous user.\n\n## Session-based Authentication\n\nThis means you have to login to OpenProject via the Web-Interface to be authenticated in the API.\nThis method is well-suited for clients acting within the browser, like the Angular-Client built into OpenProject.\n\nIn this case, you always need to pass the HTTP header `X-Requested-With \"XMLHttpRequest\"` for authentication.\n\n## API Key through Basic Auth\n\nUsers can authenticate towards the API v3 using basic auth with `apikey` (as a string, NOT your API key) as the user name and their API key as the password.\nUsers can find their API key on their account page.\n\nExample:\n\n```bash\nAPI_KEY=2519132cdf62dcf5a66fd96394672079f9e9cad1\ncurl -u apikey:$API_KEY https://community.openproject.com/api/v3/users/42\n```\n\n## OAuth2.0 authentication\n\nOpenProject allows authentication and authorization with OAuth2 with *Authorization code flow*, as well as *Client credentials* operation modes.\n\nTo get started, you first need to register an application in the OpenProject OAuth administration section of your installation.\nThis will save an entry for your application with a client unique identifier (`client_id`) and an accompanying secret key (`client_secret`).\n\nYou can then use one the following guides to perform the supported OAuth 2.0 flows:\n\n- [Authorization code flow](https://oauth.net/2/grant-types/authorization-code)\n\n- [Client credentials](https://oauth.net/2/grant-types/client-credentials/) - Requires an application to be bound to an impersonating user for non-public access\n\n## Why not username and password?\n\nThe simplest way to do basic auth would be to use a user's username and password naturally.\nHowever, OpenProject already has supported API keys in the past for the API v2, though not through basic auth.\n\nUsing **username and password** directly would have some advantages:\n\n* It is intuitive for the user who then just has to provide those just as they would when logging into OpenProject.\n\n* No extra logic for token management necessary.\n\nOn the other hand using **API keys** has some advantages too, which is why we went for that:\n\n* If compromised while saved on an insecure client the user only has to regenerate the API key instead of changing their password, too.\n\n* They are naturally long and random which makes them invulnerable to dictionary attacks and harder to crack in general.\n\nMost importantly users may not actually have a password to begin with. Specifically when they have registered\nthrough an OpenID Connect provider.\n\n# Cross-Origin Resource Sharing (CORS)\n\nBy default, the OpenProject API is _not_ responding with any CORS headers.\nIf you want to allow cross-domain AJAX calls against your OpenProject instance, you need to enable CORS headers being returned.\n\nPlease see [our API settings documentation](https://docs.openproject.org/system-admin-guide/system-settings/api-settings/) on\nhow to selectively enable CORS.\n\n# Allowed HTTP methods\n\n- `GET` - Get a single resource or collection of resources\n\n- `POST` - Create a new resource or perform\n\n- `PATCH` - Update a resource\n\n- `DELETE` - Delete a resource\n\n# Compression\n\nResponses are compressed if requested by the client. Currently [gzip](http://www.gzip.org/) and [deflate](https://tools.ietf.org/html/rfc1951)\nare supported. The client signals the desired compression by setting the [`Accept-Encoding` header](https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.3).\nIf no `Accept-Encoding` header is send, `Accept-Encoding: identity` is assumed which will result in the API responding uncompressed."
},
"paths": {
"/api/v3/examples": {
"get": {
"responses": {
"200": {
"description": "OK",
"headers": {},
"examples": {}
}
},
"summary": "view aggregated result",
"operationId": "view aggregated result",
"description": "",
"tags": [
"Collections"
],
"parameters": [
{
"name": "groupBy",
"in": "query",
"description": "The column to group by.\nNote: Aggregation is as of now only supported by the work package collection.\nYou can pass any column name as returned by the [queries](#queries) endpoint.",
"required": false,
"x-example": "status",
"type": "string"
},
{
"name": "showSums",
"in": "query",
"description": "",
"required": false,
"type": "string",
"default": "false"
}
]
}
},
"/api/v3/example/form": {
"post": {
"responses": {
"200": {
"description": "OK",
"headers": {},
"examples": {
"application/hal+json": {
"_links": {
"self": {
"href": "/api/v3/example/form"
},
"validate": {
"href": "/api/v3/example/form",
"method": "POST"
},
"previewMarkup": {
"href": "/api/v3/render/markdown",
"method": "POST"
},
"commit": {
"href": "/api/v3/example",
"method": "PATCH"
}
},
"_type": "Form",
"_embedded": {
"payload": {
"_links": {
"status": {
"href": "/api/v3/statuses/1"
}
},
"_type": "Example",
"lockVersion": 5,
"subject": "An example title"
},
"schema": {
"_type": "Schema",
"_links": {
"self": {
"href": "/api/v3/example/schema"
}
},
"lockVersion": {
"type": "Integer",
"writable": false
},
"subject": {
"type": "String",
"minLength": 1,
"maxLength": 255
},
"status": {
"_links": {
"allowedValues": [
{
"href": "/api/v3/statuses/1",
"title": "New"
},
{
"href": "/api/v3/statuses/2",
"title": "Closed"
}
]
},
"type": "Status",
"_embedded": {
"allowedValues": [
{
"_links": {
"self": {
"href": "/api/v3/statuses/1"
}
},
"_type": "Status",
"id": 1,
"name": "New",
"position": 1,
"isDefault": true,
"isClosed": false,
"defaultDoneRatio": 0,
"createdAt": "2014-05-21T08:51:20Z",
"updatedAt": "2014-05-21T09:12:00Z"
},
{
"_links": {
"self": {
"href": "/api/v3/statuses/2"
}
},
"_type": "Status",
"id": 2,
"name": "Closed",
"position": 2,
"isDefault": false,
"isClosed": true,
"defaultDoneRatio": 100,
"createdAt": "2014-05-21T08:51:20Z",
"updatedAt": "2014-05-21T09:12:00Z"
}
]
}
}
},
"validationErrors": {
"subject": {
"_type": "Error",
"errorIdentifier": "urn:openproject-org:api:v3:errors:BadExampleError",
"message": "For the purpose of this example we need a validation error. The remainder of the response pretends there were no errors."
}
}
}
}
},
"schema": {
"$ref": "#/definitions/Example FormModel"
}
},
"400": {
"description": "Occurs when the client did not send a valid JSON object in the request body and the request body\nwas not empty.\n\nNote that this error only occurs when the content is not at all a single JSON object.\nIt **does not occur** for requests containing undefined properties or invalid property values.",
"headers": {},
"examples": {
"application/hal+json": {
"_type": "Error",
"errorIdentifier": "urn:openproject-org:api:v3:errors:InvalidRequestBody",
"message": "The request body was neither empty, nor did it contain a single JSON object."
}
}
},
"403": {
"description": "Returned if the client does not have sufficient permissions to modify the associated resource.",
"headers": {},
"examples": {
"application/hal+json": {
"_type": "Error",
"errorIdentifier": "urn:openproject-org:api:v3:errors:MissingPermission",
"message": "You are not allowed to edit example resources."
}
}
},
"409": {
"description": "Returned if underlying resource was changed since the client requested the form. This is determined using the `lockVersion` property.",
"headers": {},
"examples": {
"application/hal+json": {
"_type": "Error",
"errorIdentifier": "urn:openproject-org:api:v3:errors:UpdateConflict",
"message": "The resource you are about to edit was changed in the meantime."
}
}
}
},
"summary": "show or validate form",
"operationId": "show or validate form",
"description": "This is an example of how a form might look like. Note that this endpoint does not exist in the actual implementation.",
"tags": [
"Forms"
],
"parameters": [
{
"name": "body",
"in": "body",
"schema": {
"type": "object",
"properties": {
"lockVersion": {
"type": "number"
},
"_type": {
"type": "string"
},
"subject": {
"type": "string"
}
},
"example": {
"lockVersion": 5,
"_type": "Example",
"subject": "An example title"
}
}
}
],
"produces": [
"application/hal+json"
]
}
},
"/api/v3/actions/{id}": {
"get": {
"responses": {
"200": {
"description": "OK",
"headers": {},
"examples": {},
"schema": {
"$ref": "#/definitions/View actionModel"
}
},
"404": {
"description": "Returned if the action does not exist.",
"headers": {},
"examples": {
"application/hal+json": {
"_type": "Error",
"errorIdentifier": "urn:openproject-org:api:v3:errors:NotFound",
"message": "The requested resource could not be found."
}
}
}
},
"summary": "View action",
"operationId": "View action",
"description": "Returns an individual action.",
"tags": [
"Actions & Capabilities"
],
"parameters": [
{
"name": "id",
"in": "path",
"description": "action id which is the name of the action",
"required": true,
"x-example": "work_packages/create",
"type": "string"
}
],
"produces": [
"application/hal+json"
]
}
},
"/api/v3/actions": {
"get": {
"responses": {
"200": {
"description": "OK",
"headers": {},
"examples": {},
"schema": {
"$ref": "#/definitions/List actionsModel"
}
}
},
"summary": "List actions",
"operationId": "List actions",
"description": "Returns a collection of actions. The client can choose to filter the actions similar to how work packages are filtered.\nIn addition to the provided filters, the server will reduce the result set to only contain actions, for which the requesting client\nhas sufficient permissions.",
"tags": [
"Actions & Capabilities"
],
"parameters": [
{
"name": "filters",
"in": "query",
"description": "JSON specifying filter conditions.\nAccepts the same format as returned by the [queries](#queries) endpoint.\nCurrently supported filters are:\n\n+ id: Returns only the action having the id or all actions except those having the id(s).",
"required": false,
"x-example": "[{ \"id\": { \"operator\": \"=\", \"values\": [\"memberships/create\"] }\" }]",
"type": "string"
},
{
"name": "sortBy",
"in": "query",
"description": "JSON specifying sort criteria.\nAccepts the same format as returned by the [queries](#queries) endpoint. Currently supported sorts are:\n\n+ *No sort supported yet*",
"required": false,
"x-example": "[[\"id\", \"asc\"]]",
"type": "string",
"default": "[\"id\", \"asc\"]"
}
]
}
},
"/api/v3/capabilities/{id}": {
"get": {
"responses": {
"200": {
"description": "OK",
"headers": {},
"examples": {
"application/hal+json": {
"_links": {
"self": {
"href": "/api/v3/capabilities/work_packages/create/p123-567"
},
"action": {
"href": "/api/v3/actions/work_packages/create",
"title": "Add work package"
},
"context": {
"href": "/api/v3/projects/123",
"title": "A project"
},
"principal": {
"href": "/api/v3/users/567",
"title": "Some user"
}
},
"_type": "Capability",
"id": "work_packages/create/p123-567"
}
},
"schema": {
"$ref": "#/definitions/View capabilitiesModel"
}
},
"404": {
"description": "Returned if the capability does not exist.",
"headers": {},
"examples": {
"application/hal+json": {
"_type": "Error",
"errorIdentifier": "urn:openproject-org:api:v3:errors:NotFound",
"message": "The requested resource could not be found."
}
}
}
},
"summary": "View capabilities",
"operationId": "View capabilities",
"description": "",
"tags": [
"Actions & Capabilities"
],
"parameters": [
{
"name": "id",
"in": "path",
"description": "capability id",
"required": true,
"x-example": "work_packages/create/p123-567",
"type": "string"
}
],
"produces": [
"application/hal+json"
]
}
},
"/api/v3/capabilities": {
"get": {
"responses": {
"200": {
"description": "OK",
"headers": {},
"examples": {},
"schema": {
"$ref": "#/definitions/List capabilitiesModel"
}
}
},
"summary": "List capabilities",
"operationId": "List capabilities",
"description": "Returns a collection of actions assigned to a principal in a context. The client can choose to filter the actions similar to how work packages are filtered. In addition to the provided filters, the server will reduce the result set to only contain actions, for which the requesting client has sufficient permissions",
"tags": [
"Actions & Capabilities"
],
"parameters": [
{
"name": "filters",
"in": "query",
"description": "JSON specifying filter conditions.\nAccepts the same format as returned by the [queries](#queries) endpoint.\n\n+ action: Get all capabilities of a certain action\n\n+ principal: Get all capabilities of a principal\n\n+ context: Get all capabilities within a context. Note that for a project context the client needs to provide `p{id}`, e.g. `p5` and for the global context a `g`",
"required": false,
"x-example": "[{ \"principal\": { \"operator\": \"=\", \"values\": [\"1\"] }\" }]",
"type": "string"
},
{
"name": "sortBy",
"in": "query",
"description": "JSON specifying sort criteria.\nAccepts the same format as returned by the [queries](#queries) endpoint. Currently supported sorts are:\n\n+ id: Sort by the capabilities id",
"required": false,
"x-example": "[[\"id\", \"asc\"]]",
"type": "string",
"default": "[\"id\", \"asc\"]"
}
]
}
},
"/api/v3/capabilities/context/global": {
"get": {
"responses": {
"200": {
"description": "OK",
"headers": {},
"examples": {
"application/hal+json": {
"_links": {
"self": {
"href": "/api/v3/capabilities/context/global"
}
},
"_type": "CapabilityContext::Global",
"id": "global"
}
},
"schema": {
"$ref": "#/definitions/View global contextModel"
}
},
"404": {
"description": "Returned if the action does not exist.",
"headers": {},
"examples": {
"application/hal+json": {
"_type": "Error",
"errorIdentifier": "urn:openproject-org:api:v3:errors:NotFound",
"message": "The requested resource could not be found."
}
}
}
},
"summary": "View global context",
"operationId": "View global context",
"description": "Returns the global capability context. This context is necessary to consistently link to a context even if the context is not a project.",
"tags": [
"Actions & Capabilities"
],
"parameters": [],
"produces": [
"application/hal+json"
]
}
},
"/api/v3/activities/{id}": {
"get": {
"responses": {
"200": {
"description": "OK",
"headers": {},
"examples": {
"application/hal+json": {
"_type": "Activity::Comment",
"_links": {
"self": {
"href": "/api/v3/activity/1",
"title": "Priority changed from High to Low"
},
"workPackage": {
"href": "/api/v3/work_packages/1",
"title": "quis numquam qui voluptatum quia praesentium blanditiis nisi"
},
"user": {
"href": "/api/v3/users/1",
"title": "John Sheppard - admin"
}
},
"id": 1,
"details": [
{
"format": "markdown",
"raw": "Lorem ipsum dolor sit amet.",
"html": "<p>Lorem ipsum dolor sit amet.</p>"
}
],
"comment": {
"format": "markdown",
"raw": "Lorem ipsum dolor sit amet.",
"html": "<p>Lorem ipsum dolor sit amet.</p>"
},
"createdAt": "2014-05-21T08:51:20Z",
"version": 31
}
},
"schema": {
"$ref": "#/definitions/ActivityModel"
}
}
},
"summary": "View activity",
"operationId": "View activity",
"description": "",
"tags": [
"Activities"
],
"parameters": [
{
"name": "id",
"in": "path",
"description": "Activity id",
"required": true,
"x-example": "1",
"type": "integer"
}
],
"produces": [
"application/hal+json"
]
},
"patch": {
"responses": {
"200": {
"description": "OK",
"headers": {},
"examples": {
"application/hal+json": {
"_type": "Activity::Comment",
"_links": {
"self": {
"href": "/api/v3/activity/1",
"title": "Priority changed from High to Low"
},
"workPackage": {
"href": "/api/v3/work_packages/1",
"title": "quis numquam qui voluptatum quia praesentium blanditiis nisi"
},
"user": {
"href": "/api/v3/users/1",
"title": "John Sheppard - admin"
}
},
"id": 1,
"details": [
{
"format": "markdown",
"raw": "Lorem ipsum dolor sit amet.",
"html": "<p>Lorem ipsum dolor sit amet.</p>"
}
],
"comment": {
"format": "markdown",
"raw": "Lorem ipsum dolor sit amet.",
"html": "<p>Lorem ipsum dolor sit amet.</p>"
},
"createdAt": "2014-05-21T08:51:20Z",
"version": 31
}
},
"schema": {
"$ref": "#/definitions/ActivityModel"
}
},
"400": {
"description": "Occurs when the client did not send a valid JSON object in the request body.",
"headers": {},
"examples": {
"application/hal+json": {
"_type": "Error",
"errorIdentifier": "urn:openproject-org:api:v3:errors:InvalidRequestBody",
"message": "The request body was not a single JSON object."
}
}
},
"403": {
"description": "Returned if the client does not have sufficient permissions.\n\n**Required permission:** edit journals",
"headers": {},
"examples": {
"application/hal+json": {
"_type": "Error",
"errorIdentifier": "urn:openproject-org:api:v3:errors:MissingPermission",
"message": "You are not allowed to edit the comment of this journal entry."
}
}
},
"422": {
"description": "Returned if the client tries to modify a read-only property.",
"headers": {},
"examples": {
"application/hal+json": {
"_type": "Error",
"errorIdentifier": "urn:openproject-org:api:v3:errors:PropertyIsReadOnly",
"message": "The ID of an activity can't be changed."
}
}
}
},
"summary": "Update activity",
"operationId": "Update activity",
"description": "Updates an activity's comment and, on success, returns the updated activity.",
"tags": [
"Activities"
],
"parameters": [
{
"name": "id",
"in": "path",
"description": "Activity id",
"required": true,
"x-example": "1",
"type": "integer"
},
{
"name": "body",
"in": "body",
"schema": {
"type": "object",
"properties": {
"comment": {
"type": "object",
"properties": {
"raw": {
"type": "string"
}
}
}
},
"example": {
"comment": {
"raw": "The updated comment"
}
}
}
}
],
"produces": [
"application/hal+json"
]
}
},
"/api/v3/attachments": {
"post": {
"responses": {
"200": {
"description": "OK",
"headers": {},
"examples": {},
"schema": {
"$ref": "#/definitions/AttachmentModel"
}
},
"400": {
"description": "Returned if the client sends a not understandable request. Reasons include:\n\n* Omitting one of the required parts (metadata and file)\n\n* sending unparsable JSON in the metadata part",
"headers": {},
"examples": {
"application/hal+json": {
"_type": "Error",
"errorIdentifier": "urn:openproject-org:api:v3:errors:InvalidRequestBody",
"message": "The request could not be parsed as JSON."
}
}
},
"403": {
"description": "Returned if the client does not have sufficient permissions.\n\n**Required permission:** At least one permission in any project: edit work package, add work package, edit messages, edit wiki pages (plugins might extend this list)",
"headers": {},
"examples": {
"application/hal+json": {
"_type": "Error",
"errorIdentifier": "urn:openproject-org:api:v3:errors:MissingPermission",
"message": "You are not allowed to delete this attachment."
}
}
},
"422": {
"description": "Returned if the client tries to send an invalid attachment.\nReasons are:\n\n* Omitting the file name (`fileName` property of metadata part)\n\n* Sending a file that is too large",
"headers": {},
"examples": {
"application/hal+json": {
"_type": "Error",
"errorIdentifier": "urn:openproject-org:api:v3:errors:PropertyConstraintViolation",
"message": "File is too large (maximum size is 5242880 Bytes)."
}
}
}
},
"summary": "Create Attachment",
"operationId": "Create Attachment",
"description": "Clients can create attachments without a container first and attach them later on.\nThis is useful if the container does not exist at the time the attachment is uploaded.\nAfter the upload, the client can then claim such containerless attachments for any resource eligible (e.g. WorkPackage) on subsequent requests.\nThe upload and the claiming *must* be done for the same user account. Attachments uploaded by another user cannot be claimed and\nonce claimed for a resource, they cannot be claimed by another.\n\nThe upload request must be of type `multipart/form-data` with exactly two parts.\n\nThe first part *must* be called `metadata`. Its content type is expected to be `application/json`,\nthe body *must* be a single JSON object, containing at least the `fileName` and optionally the attachments `description`.\n\nThe second part *must* be called `file`, its content type *should* match the mime type of the file.\nThe body *must* be the raw content of the file.\nNote that a `filename` *must* be indicated in the `Content-Disposition` of this part, although it will be ignored.\nInstead the `fileName` inside the JSON of the metadata part will be used.",
"tags": [
"Attachments"
],
"parameters": [],
"produces": [
"application/hal+json"
]
}
},
"/api/v3/attachments/{id}": {
"get": {
"responses": {
"200": {
"description": "OK",
"headers": {},
"examples": {},
"schema": {
"$ref": "#/definitions/AttachmentModel"
}
},
"404": {
"description": "Returned if the attachment does not exist or the client does not have sufficient permissions\nto see it.\n\n**Required permission:** view permission for the container of the attachment or being the author for attachments without container\n\n*Note: A client without sufficient permissions shall not be able to test for the existence of an attachment.\nThat's why a 404 is returned here, even if a 403 might be more appropriate.*",
"headers": {},
"examples": {
"application/hal+json": {
"_type": "Error",
"errorIdentifier": "urn:openproject-org:api:v3:errors:NotFound",
"message": "The specified attachment does not exist."
}
}
}
},
"summary": "View attachment",
"operationId": "View attachment",
"description": "",
"tags": [
"Attachments"
],
"parameters": [
{
"name": "id",
"in": "path",
"description": "Attachment id",
"required": true,
"x-example": "1",
"type": "integer"
}
],
"produces": [
"application/hal+json"
]
},
"delete": {
"responses": {
"204": {
"description": "Returned if the attachment was deleted successfully.\n\nNote that the response body is empty as of now. In future versions of the API a body\n*might* be returned along with an appropriate HTTP status.",
"headers": {},
"examples": {}
},
"403": {
"description": "Returned if the client does not have sufficient permissions.\n\n**Required permission:** edit permission for the container of the attachment or being the author for attachments without container\n\n*Note that you will only receive this error, if you are at least allowed to see the attachment.*",
"headers": {},
"examples": {
"application/hal+json": {
"_type": "Error",
"errorIdentifier": "urn:openproject-org:api:v3:errors:MissingPermission",
"message": "You are not allowed to delete this attachment."
}
}
},
"404": {
"description": "Returned if the attachment does not exist or the client does not have sufficient permissions\nto see it.\n\n**Required permission:** view permission for the container of the attachment or being the author for attachments without container\n\n*Note: A client without sufficient permissions shall not be able to test for the existence of an attachment.\nThat's why a 404 is returned here, even if a 403 might be more appropriate.*",
"headers": {},
"examples": {
"application/hal+json": {
"_type": "Error",
"errorIdentifier": "urn:openproject-org:api:v3:errors:NotFound",
"message": "The specified attachment does not exist."
}
}
}
},
"summary": "Delete attachment",
"operationId": "Delete attachment",
"description": "Permanently deletes the specified attachment.",
"tags": [
"Attachments"
],
"parameters": [
{
"name": "id",
"in": "path",
"description": "Attachment id",
"required": true,
"x-example": "1",
"type": "integer"
}
],
"produces": [
"application/hal+json"
]
}
},
"/api/v3/posts/{id}/attachments": {
"get": {
"responses": {
"200": {
"description": "OK",
"headers": {},
"examples": {
"application/hal+json": {
"_type": "Collection",
"total": 1,
"count": 1,
"_embedded": {
"elements": [
{
"_type": "Attachment",
"id": 376,
"fileName": "some.gif",
"fileSize": 3521772,
"description": {
"format": "plain",
"raw": "",
"html": ""
},
"contentType": "image/gif",
"digest": {
"algorithm": "md5",
"hash": "7ac9c97ef73d47127f590788b84c0c1c"
},
"createdAt": "2018-06-01T07:24:19Z",
"_links": {
"self": {
"href": "/api/v3/attachments/376",
"title": "200.gif"
},
"author": {
"href": "/api/v3/users/1",
"title": "OpenProject Admin"
},
"container": {
"href": "/api/v3/posts/72",
"title": "wiki"
},
"downloadLocation": {
"href": "/api/v3/attachments/376/content"
},
"delete": {
"href": "/api/v3/attachments/376",
"method": "delete"
}
}
}
]
},
"_links": {
"self": {
"href": "/api/v3/posts/72/attachments"
}
}
}
},
"schema": {
"$ref": "#/definitions/Attachments by postModel"
}
},
"404": {
"description": "Returned if the post does not exist or the client does not have sufficient permissions\nto see it.\n\n**Required permission:** view messages\n\n*Note: A client without sufficient permissions shall not be able to test for the existence of a post.\nThat's why a 404 is returned here, even if a 403 might be more appropriate.*",
"headers": {},
"examples": {
"application/hal+json": {
"_type": "Error",
"errorIdentifier": "urn:openproject-org:api:v3:errors:NotFound",
"message": "The requested resource could not be found."
}
}
}
},
"summary": "List attachments",
"operationId": "List attachments",
"description": "",
"tags": [
"Attachments"
],
"parameters": [
{
"name": "id",
"in": "path",
"description": "ID of the post whose attachments will be listed",
"required": true,
"x-example": "1",
"type": "integer"
}
],
"produces": [
"application/hal+json"
]
},
"post": {
"responses": {
"200": {
"description": "OK",
"headers": {},
"examples": {
"application/hal+json": {
"_embedded": {
"author": {
"_type": "User",
"id": 1,
"name": "OpenProject Admin",
"createdAt": "2015-03-20T12:56:52Z",
"updatedAt": "2018-05-29T13:57:44Z",
"login": "admin",
"admin": true,
"firstName": "OpenProject",
"lastName": "Admin",
"email": null,
"avatar": "",
"status": "active",
"identityUrl": null,
"_links": {
"self": {
"href": "/api/v3/users/1",
"title": "OpenProject Admin"
},
"showUser": {
"href": "/users/1",
"type": "text/html"
},
"updateImmediately": {
"href": "/api/v3/users/1",
"title": "Update admin",
"method": "patch"
},
"lock": {
"href": "/api/v3/users/1/lock",
"title": "Set lock on admin",
"method": "post"
}
}
},
"container": {
"_type": "Post",
"id": 150,
"subject": "sfsdfsdfsdfsdf",
"_links": {
"self": {
"href": "/api/v3/posts/150"
},
"attachments": {
"href": "/api/v3/posts/150/attachments"
},
"addAttachment": {
"href": "/api/v3/posts/150/attachments",
"method": "post"
},
"project": {
"href": "/api/v3/projects/12",
"title": "Demo project"
}
}
}
},
"_type": "Attachment",
"id": 377,
"fileName": "some.gif",
"fileSize": 3521772,
"description": {
"format": "plain",
"raw": "",
"html": ""
},
"contentType": "image/gif",
"digest": {
"algorithm": "md5",
"hash": "7ac9c97ef73d47127f590788b84c0c1c"
},
"createdAt": "2018-06-01T07:53:36Z",
"_links": {
"self": {
"href": "/api/v3/attachments/377",
"title": "200.gif"
},
"author": {
"href": "/api/v3/users/1",
"title": "OpenProject Admin"
},
"container": {
"href": "/api/v3/posts/150",
"title": "sfsdfsdfsdfsdf"
},
"downloadLocation": {
"href": "/api/v3/attachments/377/content"
},
"delete": {
"href": "/api/v3/attachments/377",
"method": "delete"
}
}
}
}