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

[#44841] added api spec

Eric Schubert45f8c3ad9c7d
diff --git a/docs/api/apiv3/components/schemas/oauth_credential_model.yml b/docs/api/apiv3/components/schemas/oauth_credential_model.yml
new file mode 100644
index 00000000000..8966fc75cbb
--- /dev/null
+++ b/docs/api/apiv3/components/schemas/oauth_credential_model.yml
@@ -0,0 +1,23 @@
+# Schema: OauthCredentialModel
+---
+type: object
+required:
+ - _type
+ - clientId
+ - clientSecret
+properties:
+ _type:
+ type: string
+ enum:
+ - OauthCredentials
+ clientId:
+ type: string
+ description: OAuth 2 client id
+ clientSecret:
+ type: string
+ description: OAuth 2 client secret
+
+example:
+ _type: OauthCredentials
+ clientId: O5h6WObhMg1Z8IcLHRE3_LMh4jJYmmca2V6OTFSv8DA
+ clientSecret: LSk52mn4jmtSYTgH0NzDj-u2z5LMpT8bsS0BouwJQQw
diff --git a/docs/api/apiv3/components/schemas/storage_model.yml b/docs/api/apiv3/components/schemas/storage_read_model.yml
similarity index 99%
rename from docs/api/apiv3/components/schemas/storage_model.yml
rename to docs/api/apiv3/components/schemas/storage_read_model.yml
index cc49e6d2836..697d51e8e55 100644
--- a/docs/api/apiv3/components/schemas/storage_model.yml
+++ b/docs/api/apiv3/components/schemas/storage_read_model.yml
@@ -1,4 +1,4 @@
-# Schema: StorageModel
+# Schema: StorageReadModel
---
type: object
required:
diff --git a/docs/api/apiv3/components/schemas/storage_update_model.yml b/docs/api/apiv3/components/schemas/storage_update_model.yml
new file mode 100644
index 00000000000..0d4d24ee4ed
--- /dev/null
+++ b/docs/api/apiv3/components/schemas/storage_update_model.yml
@@ -0,0 +1,42 @@
+# Schema: StorageUpdateModel
+---
+type: object
+properties:
+ name:
+ type: string
+ description: Storage name
+ storageOauthClientId:
+ type: string
+ description: The client id of the oauth provider created on the storage.
+ storageOauthClientServer:
+ type: string
+ description: The client server of the oauth provider created on the storage.
+ _links:
+ type: object
+ properties:
+ url:
+ allOf:
+ - $ref: './link.yml'
+ - description: |-
+ The storage's host URL.
+
+ **Resource**: N/A
+ type:
+ allOf:
+ - $ref: './link.yml'
+ - description: |-
+ The urn of the storage type. Currently only nextcloud storages are supported.
+
+ - urn:openproject-org:api:v3:storages:nextcloud
+
+ **Resource**: N/A
+
+example:
+ name: Coruscant
+ storageOauthClientId: VTqcnqHPs1eXdKF6jtgAbe6KKwCKczBqOKr20DGHgdlN1uqK8qnHa88eTyhabxXj
+ storageOauthClientServer: OqdcHKaSfRh1En09PqOJRCfx7iKt98qvp0paJWYrDXzgAaDBiVnhurI71bhxUGF2
+ _links:
+ url:
+ href: https://nextcloud.deathstar.rocks
+ type:
+ href: urn:openproject-org:api:v3:storages:nextcloud
diff --git a/docs/api/apiv3/components/schemas/storage_write_model.yml b/docs/api/apiv3/components/schemas/storage_write_model.yml
new file mode 100644
index 00000000000..afa5a400359
--- /dev/null
+++ b/docs/api/apiv3/components/schemas/storage_write_model.yml
@@ -0,0 +1,39 @@
+# Schema: StorageWriteModel
+---
+type: object
+required:
+ - _links
+properties:
+ name:
+ type: string
+ description: Storage name, if not provided, falls back to a default.
+ _links:
+ type: object
+ required:
+ - origin
+ - type
+ properties:
+ origin:
+ allOf:
+ - $ref: './link.yml'
+ - description: |-
+ The storage's host URL.
+
+ **Resource**: N/A
+ type:
+ allOf:
+ - $ref: './link.yml'
+ - description: |-
+ The urn of the storage type. Currently only nextcloud storages are supported.
+
+ - urn:openproject-org:api:v3:storages:Nextcloud
+
+ **Resource**: N/A
+
+example:
+ name: Coruscant
+ _links:
+ origin:
+ href: https://nextcloud.deathstar.rocks
+ type:
+ href: urn:openproject-org:api:v3:storages:nextcloud
diff --git a/docs/api/apiv3/openapi-spec.yml b/docs/api/apiv3/openapi-spec.yml
index 783b1bc711d..2279726af28 100644
--- a/docs/api/apiv3/openapi-spec.yml
+++ b/docs/api/apiv3/openapi-spec.yml
@@ -353,6 +353,8 @@ paths:
"$ref": "./paths/statuses.yml"
"/api/v3/statuses/{id}":
"$ref": "./paths/status.yml"
+ "/api/v3/storages":
+ "$ref": "./paths/storages.yml"
"/api/v3/storages/{id}":
"$ref": "./paths/storage.yml"
"/api/v3/storages/{id}/files":
@@ -652,6 +654,8 @@ components:
"$ref": "./components/schemas/notification_settings_model.yml"
Offset_based_pagination:
"$ref": "./components/schemas/offset_based_pagination.yml"
+ OauthCredentialModel:
+ "$ref": "./components/schemas//oauth_credential_model.yml"
Plain_Text:
"$ref": "./components/schemas/plain_text.yml"
Plain_TextModel:
@@ -732,12 +736,16 @@ components:
"$ref": "./components/schemas/status_model.yml"
StatusesModel:
"$ref": "./components/schemas/statuses_model.yml"
- StorageModel:
- "$ref": "./components/schemas/storage_model.yml"
StorageFileModel:
"$ref": "./components/schemas/storage_file_model.yml"
StorageFileLocationModel:
"$ref": "./components/schemas/storage_file_location_model.yml"
+ StorageReadModel:
+ "$ref": "./components/schemas/storage_read_model.yml"
+ StorageUpdateModel:
+ "$ref": "./components/schemas/storage_update_model.yml"
+ StorageWriteModel:
+ "$ref": "./components/schemas/storage_write_model.yml"
Time_EntryModel:
"$ref": "./components/schemas/time_entry_model.yml"
Time_Entry_ActivityModel:
diff --git a/docs/api/apiv3/paths/storage.yml b/docs/api/apiv3/paths/storage.yml
index 547ec577760..64b7dfa0963 100644
--- a/docs/api/apiv3/paths/storage.yml
+++ b/docs/api/apiv3/paths/storage.yml
@@ -22,7 +22,64 @@ get:
content:
application/hal+json:
schema:
- $ref: '../components/schemas/storage_model.yml'
+ $ref: '../components/schemas/storage_read_model.yml'
+ '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 storage does not exist or the client does not have sufficient permissions to see it.
+
+ **Required permission:** view file links
+
+put:
+ summary: Updates a storage.
+ operationId: update_storage
+ tags:
+ - File links
+ description: |-
+ Updates a storage resource. Only data that is not generated by the server can be updated. This excludes the OAuth 2
+ application data.
+ parameters:
+ - name: id
+ description: Storage id
+ in: path
+ required: true
+ schema:
+ type: integer
+ example: 1337
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '../components/schemas/storage_update_model.yml'
+ responses:
+ '200':
+ description: OK
+ content:
+ application/hal+json:
+ schema:
+ $ref: '../components/schemas/storage_read_model.yml'
+ '403':
+ content:
+ application/hal+json:
+ schema:
+ $ref: '../components/schemas/error_response.yml'
+ examples:
+ response:
+ value:
+ _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:** admin
'404':
content:
application/hal+json:
diff --git a/docs/api/apiv3/paths/storages.yml b/docs/api/apiv3/paths/storages.yml
new file mode 100644
index 00000000000..31db5eaa26c
--- /dev/null
+++ b/docs/api/apiv3/paths/storages.yml
@@ -0,0 +1,25 @@
+# /api/v3/storages
+---
+post:
+ summary: Creates a storage.
+ operationId: create_storage
+ tags:
+ - File links
+ description: |-
+ Creates a storage resource. When creating a storage, a confidential oauth provider is created. The oauth client id
+ and secret are returned in the response.
+
+ **IMPORTANT:** This is the only time, the oauth client secret is visible to the consumer. After that, the secret is
+ hidden.
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '../components/schemas/storage_write_model.yml'
+ responses:
+ '201':
+ description: Created
+ content:
+ application/hal+json:
+ schema:
+ $ref: '../components/schemas/oauth_credential_model.yml'