Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

[#42160] added api spec for file link download

Eric Schubert9a2e8647d005
diff --git a/docs/api/apiv3/components/responses/invalid_request_body.yml b/docs/api/apiv3/components/responses/invalid_request_body.yml
index cc959a15336..a19d70eba15 100644
--- a/docs/api/apiv3/components/responses/invalid_request_body.yml
+++ b/docs/api/apiv3/components/responses/invalid_request_body.yml
@@ -3,13 +3,9 @@
content:
application/hal+json:
schema:
- $ref: "../schemas/error_response.yml"
- examples:
- response:
- value:
- _type: Error
- errorIdentifier: urn:openproject-org:api:v3:errors:InvalidRequestBody
- message: The request body was not a single JSON object.
-description: Occurs when the client did not send a valid JSON object in the
- request body.
-headers: {}
+ $ref: '../schemas/error_response.yml'
+ example:
+ _type: Error
+ errorIdentifier: urn:openproject-org:api:v3:errors:InvalidRequestBody
+ message: The request body was not a single JSON object.
+description: Occurs when the client did not send a valid JSON object in the request body.
diff --git a/docs/api/apiv3/components/responses/missing_content_type.yml b/docs/api/apiv3/components/responses/missing_content_type.yml
index 739bd95f729..f76bdb9ec70 100644
--- a/docs/api/apiv3/components/responses/missing_content_type.yml
+++ b/docs/api/apiv3/components/responses/missing_content_type.yml
@@ -5,4 +5,3 @@ content:
schema:
type: string
description: Occurs when the client did not send a Content-Type header
-headers: {}
diff --git a/docs/api/apiv3/components/responses/unsupported_media_type.yml b/docs/api/apiv3/components/responses/unsupported_media_type.yml
index 5a5611868df..629cfe28d71 100644
--- a/docs/api/apiv3/components/responses/unsupported_media_type.yml
+++ b/docs/api/apiv3/components/responses/unsupported_media_type.yml
@@ -3,12 +3,9 @@
content:
application/hal+json:
schema:
- $ref: "../schemas/error_response.yml"
- examples:
- response:
- value:
- _type: Error
- errorIdentifier: urn:openproject-org:api:v3:errors:TypeNotSupported
- message: Expected CONTENT-TYPE to be (expected value) but got (actual value).
+ $ref: '../schemas/error_response.yml'
+ example:
+ _type: Error
+ errorIdentifier: urn:openproject-org:api:v3:errors:TypeNotSupported
+ message: Expected CONTENT-TYPE to be (expected value) but got (actual value).
description: Occurs when the client sends an unsupported Content-Type header.
-headers: {}
diff --git a/docs/api/apiv3/components/schemas/file_link_read_model.yml b/docs/api/apiv3/components/schemas/file_link_read_model.yml
index 4f0ed7768fb..dc17cd0f9a0 100644
--- a/docs/api/apiv3/components/schemas/file_link_read_model.yml
+++ b/docs/api/apiv3/components/schemas/file_link_read_model.yml
@@ -121,6 +121,20 @@ properties:
- description: |-
A static uri to open the location of the origin file on the storage. Responds with a redirect.
+ **Resource**: N/A
+ originDownload:
+ allOf:
+ - $ref: './link.yml'
+ - description: |-
+ The uri to download the origin file from the origin.
+
+ **Resource**: N/A
+ staticOriginDownload:
+ allOf:
+ - $ref: './link.yml'
+ - description: |-
+ A static uri to generate a new download URL from the storage. Responds with a redirect.
+
**Resource**: N/A
example:
@@ -194,8 +208,12 @@ example:
originOpen:
href: https://nextcloud.deathstar.rocks/index.php/f/5503?openfile=1
staticOriginOpen:
- href: /api/v3/work_package/17/file_links/1337/open
+ href: /api/v3/file_links/1337/open
originOpenLocation:
href: https://nextcloud.deathstar.rocks/index.php/f/5503?openfile=0
staticOriginOpenLocation:
- href: /api/v3/work_package/17/file_links/1337/open?location=true
+ href: /api/v3/file_links/1337/open?location=true
+ originDownload:
+ href: https://nextcloud.deathstar.rocks/index.php/f/5503?openfile=0
+ staticOriginDownload:
+ href: /api/v3/file_links/1337/download
diff --git a/docs/api/apiv3/openapi-spec.yml b/docs/api/apiv3/openapi-spec.yml
index d6cdfbb28bb..72e6421adfb 100644
--- a/docs/api/apiv3/openapi-spec.yml
+++ b/docs/api/apiv3/openapi-spec.yml
@@ -201,6 +201,8 @@ paths:
"$ref": "./paths/file_link.yml"
"/api/v3/file_links/{id}/open":
"$ref": "./paths/file_link_open.yml"
+ "/api/v3/file_links/{id}/download":
+ "$ref": "./paths/file_link_download.yml"
"/api/v3/grids":
"$ref": "./paths/grids.yml"
"/api/v3/grids/form":
diff --git a/docs/api/apiv3/paths/file_link_download.yml b/docs/api/apiv3/paths/file_link_download.yml
new file mode 100644
index 00000000000..b3c5c5ea334
--- /dev/null
+++ b/docs/api/apiv3/paths/file_link_download.yml
@@ -0,0 +1,41 @@
+# /api/v3/file_links/{id}/download
+---
+get:
+ summary: Creates a download uri of the linked file.
+ operationId: download_file_link
+ tags:
+ - File links
+ description: |-
+ Creates a uri to download the origin file linked by the given file link. This uri depends on the storage type and
+ is always located on the origin storage itself.
+ parameters:
+ - name: id
+ description: File link id
+ in: path
+ required: true
+ schema:
+ type: integer
+ example: 42
+ responses:
+ '303':
+ headers:
+ Location:
+ schema:
+ type: string
+ format: uri
+ description: |-
+ Returned if the request was successful. In the `Location` header is the uri where the client can download the
+ origin file from the storage.
+ '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 if the work package does not exist or the client does not have sufficient permissions to see it.
+
+ **Required permission:** view work package, view file links
diff --git a/docs/api/apiv3/paths/file_link_open.yml b/docs/api/apiv3/paths/file_link_open.yml
index b863b1ea40f..7431826ff3c 100644
--- a/docs/api/apiv3/paths/file_link_open.yml
+++ b/docs/api/apiv3/paths/file_link_open.yml
@@ -7,7 +7,7 @@ get:
- File links
description: |-
Creates a uri to open the origin file linked by the given file link. This uri depends on the storage type and
- always is located on the origin storage itself.
+ is always located on the origin storage itself.
parameters:
- name: id
description: File link id
@@ -22,7 +22,7 @@ get:
required: false
schema:
type: boolean
- example: true
+ example: true
responses:
'303':
headers:
@@ -37,7 +37,7 @@ get:
content:
application/hal+json:
schema:
- $ref: "../components/schemas/error_response.yml"
+ $ref: '../components/schemas/error_response.yml'
example:
_type: Error
errorIdentifier: urn:openproject-org:api:v3:errors:NotFound
diff --git a/docs/api/apiv3/paths/work_packages.yml b/docs/api/apiv3/paths/work_packages.yml
index 68cbb4597f3..c49a8e862f5 100644
--- a/docs/api/apiv3/paths/work_packages.yml
+++ b/docs/api/apiv3/paths/work_packages.yml
@@ -127,13 +127,13 @@ get:
type: string
responses:
'200':
+ description: OK
content:
application/hal+json:
schema:
$ref: '../components/schemas/work_packages_model.yml'
- description: OK
'400':
- $ref: "../components/responses/invalid_request_body.yml"
+ $ref: '../components/responses/invalid_request_body.yml'
'403':
content:
application/hal+json:
@@ -149,6 +149,21 @@ get:
**Required permission:** view work packages (globally or in any project)
post:
+ summary: Create Work Package
+ operationId: Create_Work_Package
+ tags:
+ - Work Packages
+ description: |-
+ When calling this endpoint the client provides a single object, containing at least the properties and links that are required, in the body.
+ The required fields of a WorkPackage can be found in its schema, which is embedded in the respective form.
+ Note that it is only allowed to provide properties or links supporting the write operation.
+
+ A project link must be set when creating work packages through this route.
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '../components/schemas/work_package_model.yml'
parameters:
- description: |-
Indicates whether change notifications (e.g. via E-Mail) should be sent.
@@ -163,160 +178,18 @@ post:
type: boolean
responses:
'200':
+ description: OK
content:
application/hal+json:
- examples:
- response:
- value:
- _links:
- addAttachment:
- href: "/api/v3/work_packages/1528/attachments"
- method: post
- addComment:
- href: "/api/v3/work_packages/1528/activities"
- method: post
- title: Add comment
- addRelation:
- href: "/api/v3/relations"
- method: post
- title: Add relation
- addWatcher:
- href: "/api/v3/work_packages/1528/watchers"
- method: post
- payload:
- user:
- href: "/api/v3/users/{user_id}"
- templated: true
- ancestors:
- - href: "/api/v3/work_packages/1290"
- title: Root node of hierarchy
- - href: "/api/v3/work_packages/1291"
- title: Intermediate node of hierarchy
- - href: "/api/v3/work_packages/1298"
- title: nisi eligendi officiis eos delectus quis voluptas dolores
- assignee:
- href: "/api/v3/users/11"
- title: Emmie Okuneva - Adele5450
- attachments:
- href: "/api/v3/work_packages/1528/attachments"
- author:
- href: "/api/v3/users/1"
- title: OpenProject Admin - admin
- availableWatchers:
- href: "/api/v3/work_packages/1528/available_watchers"
- category:
- href: "/api/v3/categories/1298"
- title: eligend isi
- changeParent:
- href: "/api/v3/work_packages/694"
- method: patch
- title: Change parent of Bug in OpenProject
- children:
- - href: "/api/v3/work_packages/1529"
- title: Write API documentation
- customActions:
- - href: "/api/v3/work_packages/1528/custom_actions/153/execute"
- method: post
- title: Reset
- - href: "/api/v3/work_packages/1528/custom_actions/94/execute"
- method: post
- title: Forward to accounting
- customField3:
- href: api/v3/users/14
- delete:
- href: "/work_packages/bulk?ids=1528"
- method: delete
- title: Delete Develop API
- logTime:
- href: "/work_packages/1528/time_entries/new"
- title: Log time on Develop API
- type: text/html
- move:
- href: "/work_packages/1528/move/new"
- title: Move Develop API
- type: text/html
- parent:
- href: "/api/v3/work_packages/1298"
- title: nisi eligendi officiis eos delectus quis voluptas dolores
- priority:
- href: "/api/v3/priorities/2"
- title: Normal
- project:
- href: "/api/v3/projects/1"
- title: A Test Project
- relations:
- href: "/api/v3/work_packages/1528/relations"
- title: Show relations
- removeWatcher:
- href: "/api/v3/work_packages/1528/watchers/{user_id}"
- method: delete
- templated: true
- responsible:
- href: "/api/v3/users/23"
- title: Laron Leuschke - Alaina5788
- revisions:
- href: "/api/v3/work_packages/1528/revisions"
- schema:
- href: "/api/v3/work_packages/schemas/11-2"
- self:
- href: "/api/v3/work_packages/1528"
- title: Develop API
- status:
- href: "/api/v3/statuses/1"
- title: New
- timeEntries:
- href: "/work_packages/1528/time_entries"
- title: Time entries
- type: text/html
- type:
- href: "/api/v3/types/1"
- title: A Type
- update:
- href: "/api/v3/work_packages/1528"
- method: patch
- title: Update Develop API
- version:
- href: "/api/v3/versions/1"
- title: Version 1
- watch:
- href: "/api/v3/work_packages/1528/watchers"
- method: post
- payload:
- user:
- href: "/api/v3/users/1"
- watchers:
- href: "/api/v3/work_packages/1528/watchers"
- _type: WorkPackage
- createdAt: '2014-08-29T12:40:53Z'
- customField1: Foo
- customField2: 42
- derivedDueDate:
- derivedEstimatedTime: PT10H
- derivedStartDate:
- description:
- format: markdown
- html: "<p>Develop super cool OpenProject API.</p>"
- raw: Develop super cool OpenProject API.
- dueDate:
- estimatedTime: PT2H
- id: 1528
- percentageDone: 0
- scheduleManually: false
- readonly: false
- startDate:
- subject: Develop API
- updatedAt: '2014-08-29T12:44:41Z'
schema:
- "$ref": "../components/schemas/work_package_model.yml"
- description: OK
- headers: { }
+ $ref: '../components/schemas/work_package_model.yml'
'400':
- $ref: "../components/responses/invalid_request_body.yml"
+ $ref: '../components/responses/invalid_request_body.yml'
'403':
content:
application/hal+json:
schema:
- $ref: "../components/schemas/error_response.yml"
+ $ref: '../components/schemas/error_response.yml'
examples:
response:
value:
@@ -329,18 +202,15 @@ post:
**Required permission:** add work packages
*Note that you will only receive this error, if you are at least allowed to see the corresponding project.*
- headers: { }
'404':
content:
application/hal+json:
schema:
- $ref: "../components/schemas/error_response.yml"
- examples:
- response:
- value:
- _type: Error
- errorIdentifier: urn:openproject-org:api:v3:errors:NotFound
- message: The specified project does not exist.
+ $ref: '../components/schemas/error_response.yml'
+ example:
+ _type: Error
+ errorIdentifier: urn:openproject-org:api:v3:errors:NotFound
+ message: The specified project does not exist.
description: |-
Returned if the project does not exist or the client does not have sufficient permissions
to see it.
@@ -349,7 +219,6 @@ post:
*Note: A client without sufficient permissions shall not be able to test for the existence of a project.
That's why a 404 is returned here, even if a 403 might be more appropriate.*
- headers: { }
'406':
$ref: "../components/responses/missing_content_type.yml"
'415':
@@ -359,15 +228,13 @@ post:
application/hal+json:
schema:
$ref: "../components/schemas/error_response.yml"
- examples:
- response:
- value:
- _embedded:
- details:
- attribute: Subject
- _type: Error
- errorIdentifier: urn:openproject-org:api:v3:errors:PropertyConstraintViolation
- message: The subject might not be blank.
+ example:
+ _type: Error
+ errorIdentifier: urn:openproject-org:api:v3:errors:PropertyConstraintViolation
+ message: The subject might not be blank.
+ _embedded:
+ details:
+ attribute: Subject
description: |-
Returned if:
@@ -376,19 +243,3 @@ post:
* a constraint for a property was violated
* a property was provided in an unreadable format
- headers: { }
- tags:
- - Work Packages
- description: |-
- When calling this endpoint the client provides a single object, containing at least the properties and links that are required, in the body.
- The required fields of a WorkPackage can be found in its schema, which is embedded in the respective form.
- Note that it is only allowed to provide properties or links supporting the write operation.
-
- A project link must be set when creating work packages through this route.
- operationId: Create_Work_Package
- requestBody:
- content:
- application/json:
- schema:
- "$ref": "../components/schemas/work_package_model.yml"
- summary: Create Work Package