|
5006 | 5006 | } |
5007 | 5007 | } |
5008 | 5008 | }, |
5009 | | - "/ocs/v2.php/apps/forms/api/v3/forms/{formId}/submissions/files/{questionId}/register": { |
| 5009 | + "/ocs/v2.php/apps/forms/api/v3/forms/{formId}/submissions/files/{questionId}/share": { |
5010 | 5010 | "post": { |
5011 | | - "operationId": "api-register-uploaded-file", |
5012 | | - "summary": "Register a file that was uploaded to an upload share", |
5013 | | - "description": "This endpoint allows CORS requests", |
| 5011 | + "operationId": "api-create-upload-share", |
| 5012 | + "summary": "Create a temporary upload share for a file question", |
| 5013 | + "description": "Creates a temporary folder inside the form owner's storage and shares it via a create-only (file drop) public link. This allows uploading files over WebDAV - including chunked uploads - before the form is submitted. Uploaded files have to be registered using the `register` endpoint.\nThis endpoint allows CORS requests", |
5014 | 5014 | "tags": [ |
5015 | 5015 | "api" |
5016 | 5016 | ], |
|
5021 | 5021 | } |
5022 | 5022 | ], |
5023 | 5023 | "requestBody": { |
5024 | | - "required": true, |
| 5024 | + "required": false, |
5025 | 5025 | "content": { |
5026 | 5026 | "application/json": { |
5027 | 5027 | "schema": { |
5028 | 5028 | "type": "object", |
5029 | 5029 | "properties": { |
5030 | | - "shareToken": { |
5031 | | - "type": "string", |
5032 | | - "description": "token of the upload share (see `share` endpoint)" |
5033 | | - }, |
5034 | | - "fileName": { |
5035 | | - "type": "string", |
5036 | | - "description": "name of the uploaded file inside the share" |
5037 | | - }, |
5038 | 5030 | "shareHash": { |
5039 | 5031 | "type": "string", |
5040 | 5032 | "default": "", |
5041 | 5033 | "description": "hash of the form share" |
5042 | 5034 | } |
5043 | | - }, |
5044 | | - "required": [ |
5045 | | - "shareToken", |
5046 | | - "fileName" |
5047 | | - ] |
| 5035 | + } |
5048 | 5036 | } |
5049 | 5037 | } |
5050 | 5038 | } |
|
5083 | 5071 | ], |
5084 | 5072 | "responses": { |
5085 | 5073 | "200": { |
5086 | | - "description": "the file id and name of the registered file", |
| 5074 | + "description": "the token of the created upload share", |
5087 | 5075 | "content": { |
5088 | 5076 | "application/json": { |
5089 | 5077 | "schema": { |
|
5103 | 5091 | "$ref": "#/components/schemas/OCSMeta" |
5104 | 5092 | }, |
5105 | 5093 | "data": { |
5106 | | - "$ref": "#/components/schemas/UploadedFile" |
| 5094 | + "$ref": "#/components/schemas/UploadShare" |
5107 | 5095 | } |
5108 | 5096 | } |
5109 | 5097 | } |
|
5113 | 5101 | } |
5114 | 5102 | }, |
5115 | 5103 | "400": { |
5116 | | - "description": "File type is not allowed", |
| 5104 | + "description": "Could not create the upload share", |
5117 | 5105 | "content": { |
5118 | 5106 | "application/json": { |
5119 | 5107 | "schema": { |
|
5169 | 5157 | } |
5170 | 5158 | }, |
5171 | 5159 | "404": { |
5172 | | - "description": "Could not find question or uploaded file", |
| 5160 | + "description": "Could not find question", |
5173 | 5161 | "content": { |
5174 | 5162 | "application/json": { |
5175 | 5163 | "schema": { |
|
5199 | 5187 | } |
5200 | 5188 | } |
5201 | 5189 | }, |
5202 | | - "/ocs/v2.php/apps/forms/api/v3/forms/{formId}/submissions/files/{questionId}/share": { |
| 5190 | + "/ocs/v2.php/apps/forms/api/v3/forms/{formId}/submissions/files/{questionId}/register": { |
5203 | 5191 | "post": { |
5204 | | - "operationId": "api-create-upload-share", |
5205 | | - "summary": "Create a temporary upload share for a file question", |
5206 | | - "description": "This endpoint allows CORS requests", |
| 5192 | + "operationId": "api-register-uploaded-file", |
| 5193 | + "summary": "Register a file that was uploaded to an upload share", |
| 5194 | + "description": "Looks up the file inside the folder of the given upload share, validates it against the question settings and binds it to the form and question. The returned `uploadedFileId` and `uploadToken` can then be used as an answer when submitting the form.\nThis endpoint allows CORS requests", |
5207 | 5195 | "tags": [ |
5208 | 5196 | "api" |
5209 | 5197 | ], |
|
5214 | 5202 | } |
5215 | 5203 | ], |
5216 | 5204 | "requestBody": { |
5217 | | - "required": false, |
| 5205 | + "required": true, |
5218 | 5206 | "content": { |
5219 | 5207 | "application/json": { |
5220 | 5208 | "schema": { |
5221 | 5209 | "type": "object", |
| 5210 | + "required": [ |
| 5211 | + "shareToken", |
| 5212 | + "fileName" |
| 5213 | + ], |
5222 | 5214 | "properties": { |
| 5215 | + "shareToken": { |
| 5216 | + "type": "string", |
| 5217 | + "description": "token of the upload share (see `share` endpoint)" |
| 5218 | + }, |
| 5219 | + "fileName": { |
| 5220 | + "type": "string", |
| 5221 | + "description": "name of the uploaded file inside the share" |
| 5222 | + }, |
5223 | 5223 | "shareHash": { |
5224 | 5224 | "type": "string", |
5225 | 5225 | "default": "", |
|
5264 | 5264 | ], |
5265 | 5265 | "responses": { |
5266 | 5266 | "200": { |
5267 | | - "description": "the token of the created upload share", |
| 5267 | + "description": "the file id and name of the registered file", |
5268 | 5268 | "content": { |
5269 | 5269 | "application/json": { |
5270 | 5270 | "schema": { |
|
5284 | 5284 | "$ref": "#/components/schemas/OCSMeta" |
5285 | 5285 | }, |
5286 | 5286 | "data": { |
5287 | | - "$ref": "#/components/schemas/UploadShare" |
| 5287 | + "$ref": "#/components/schemas/UploadedFile" |
5288 | 5288 | } |
5289 | 5289 | } |
5290 | 5290 | } |
|
5294 | 5294 | } |
5295 | 5295 | }, |
5296 | 5296 | "400": { |
5297 | | - "description": "Could not create the upload share", |
| 5297 | + "description": "File type is not allowed", |
5298 | 5298 | "content": { |
5299 | 5299 | "application/json": { |
5300 | 5300 | "schema": { |
|
5350 | 5350 | } |
5351 | 5351 | }, |
5352 | 5352 | "404": { |
5353 | | - "description": "Could not find question", |
| 5353 | + "description": "Could not find question or uploaded file", |
5354 | 5354 | "content": { |
5355 | 5355 | "application/json": { |
5356 | 5356 | "schema": { |
|
0 commit comments