Merge pull request #11966 from opf/implementation/45908-api-specification-add-prepare-upload-endpoint
[#45908] API specification: Add prepare upload endpointpull/11993/head
commit
f3e86b9e93
@ -0,0 +1,34 @@ |
||||
# Schema: StorageFileUploadLinkModel |
||||
--- |
||||
type: object |
||||
required: |
||||
- _type |
||||
- _links |
||||
properties: |
||||
_type: |
||||
type: string |
||||
enum: |
||||
- UploadLink |
||||
_links: |
||||
type: object |
||||
required: |
||||
- self |
||||
- destination |
||||
properties: |
||||
self: |
||||
allOf: |
||||
- $ref: './link.yml' |
||||
- description: |- |
||||
The resource link of the upload link resource. |
||||
|
||||
As the upload link is a temporal object, and cannot be retrieved again, the |
||||
self link usually is `urn:openproject-org:api:v3:storages:upload_link:no_link_provided`. |
||||
|
||||
**Resource**: UploadLink |
||||
destination: |
||||
allOf: |
||||
- $ref: './link.yml' |
||||
- description: |- |
||||
The direct upload link. |
||||
|
||||
**Resource**: N/A |
@ -0,0 +1,20 @@ |
||||
# Schema: StorageFileUploadPreparationModel |
||||
--- |
||||
type: object |
||||
required: |
||||
- projectId |
||||
- fileName |
||||
- parent |
||||
properties: |
||||
projectId: |
||||
type: integer |
||||
description: The project identifier, from where a user starts uploading a file. |
||||
minimum: 1 |
||||
fileName: |
||||
type: string |
||||
description: The file name. |
||||
parent: |
||||
type: string |
||||
description: |- |
||||
The directory to which the file is to be uploaded. For root directories, the value `/` must |
||||
be provided. |
@ -1,2 +0,0 @@ |
||||
# Schema: Time_entry_create_form |
||||
--- {} |
@ -1,2 +0,0 @@ |
||||
# Schema: Time_entry_update_form |
||||
--- {} |
@ -1,2 +0,0 @@ |
||||
# Schema: Unlock_user |
||||
--- {} |
@ -1,2 +0,0 @@ |
||||
# Schema: Update_group |
||||
--- {} |
@ -1,2 +0,0 @@ |
||||
# Schema: Update_User |
||||
--- {} |
@ -0,0 +1,71 @@ |
||||
# /api/v3/storages/{id}/files/prepare_upload |
||||
--- |
||||
post: |
||||
summary: Preparation of a direct upload of a file to the given storage. |
||||
operationId: prepare_storage_file_upload |
||||
tags: |
||||
- File links |
||||
description: |- |
||||
Executes a request that prepares a link for a direct upload to the storage. |
||||
|
||||
The background here is, that the client needs to make a direct request to the storage instance for file uploading, |
||||
but should not get access to the credentials, which are stored in the backend. The response contains a link object, |
||||
that enables the client to execute a file upload without the real credentials. |
||||
parameters: |
||||
- name: id |
||||
description: Storage id |
||||
in: path |
||||
required: true |
||||
schema: |
||||
type: integer |
||||
example: 1337 |
||||
requestBody: |
||||
content: |
||||
application/json: |
||||
schema: |
||||
$ref: '../components/schemas/storage_file_upload_preparation_model.yml' |
||||
responses: |
||||
'201': |
||||
description: OK |
||||
content: |
||||
application/hal+json: |
||||
schema: |
||||
$ref: '../components/schemas/storage_file_upload_link_model.yml' |
||||
'400': |
||||
description: Returned if the given parent parameter value does not refer to a directory. |
||||
content: |
||||
application/hal+json: |
||||
schema: |
||||
$ref: '../components/schemas/error_response.yml' |
||||
example: |
||||
_type: Error |
||||
errorIdentifier: urn:openproject-org:api:v3:errors:InvalidQuery |
||||
message: The given parent is not a directory. |
||||
'403': |
||||
content: |
||||
application/hal+json: |
||||
schema: |
||||
$ref: '../components/schemas/error_response.yml' |
||||
example: |
||||
_type: Error |
||||
errorIdentifier: urn:openproject-org:api:v3:errors:MissingPermission |
||||
message: You are not authorized to access this resource. |
||||
description: |- |
||||
Returned if the client does not have sufficient permissions. |
||||
|
||||
**Required permission:** manage file links |
||||
'404': |
||||
content: |
||||
application/hal+json: |
||||
schema: |
||||
$ref: '../components/schemas/error_response.yml' |
||||
example: |
||||
_type: Error |
||||
errorIdentifier: urn:openproject-org:api:v3:errors:NotFound |
||||
message: The requested resource could not be found. |
||||
description: |- |
||||
Returned in either of those cases: |
||||
- if the storage does not exist or the client does not have sufficient permissions to see it |
||||
|
||||
**Required permission:** view file links |
||||
- if the document root file identification does not exist on the storage |
Loading…
Reference in new issue