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

Add requestBody to some queries API endpoints

Christophe Bliardf8f5fde3318c
diff --git a/docs/api/apiv3/components/schemas/query_create_form.yml b/docs/api/apiv3/components/schemas/query_create_form.yml
index 5dbab5e4488..c1411fa816b 100644
--- a/docs/api/apiv3/components/schemas/query_create_form.yml
+++ b/docs/api/apiv3/components/schemas/query_create_form.yml
@@ -1,2 +1,11 @@
# Schema: Query_Create_Form
---- {}
+---
+type: object
+properties:
+ name:
+ type: string
+ description: Query name.
+ # There are additional properties not mentioned here
+
+example:
+ name: New query name
diff --git a/docs/api/apiv3/components/schemas/query_update_form.yml b/docs/api/apiv3/components/schemas/query_update_form.yml
new file mode 100644
index 00000000000..40968679565
--- /dev/null
+++ b/docs/api/apiv3/components/schemas/query_update_form.yml
@@ -0,0 +1,11 @@
+# Schema: Query_Update_Form
+---
+type: object
+properties:
+ name:
+ type: string
+ description: Query name.
+ # There are additional properties not mentioned here
+
+example:
+ name: Updated query name
diff --git a/docs/api/apiv3/openapi-spec.yml b/docs/api/apiv3/openapi-spec.yml
index fba2278d7f1..f842ea7d856 100644
--- a/docs/api/apiv3/openapi-spec.yml
+++ b/docs/api/apiv3/openapi-spec.yml
@@ -329,6 +329,8 @@ paths:
"$ref": "./paths/queries_sort_by.yml"
"/api/v3/queries/{id}":
"$ref": "./paths/query.yml"
+ "/api/v3/queries/{id}/form":
+ "$ref": "./paths/query_form.yml"
"/api/v3/queries/{id}/star":
"$ref": "./paths/query_star.yml"
"/api/v3/queries/{id}/unstar":
@@ -712,6 +714,8 @@ components:
"$ref": "./components/schemas/query_operator_model.yml"
Query_Sort_ByModel:
"$ref": "./components/schemas/query_sort_by_model.yml"
+ Query_Update_Form:
+ "$ref": "./components/schemas/query_update_form.yml"
RelationModel:
"$ref": "./components/schemas/relation_model.yml"
Relation_edit_formModel:
diff --git a/docs/api/apiv3/paths/queries.yml b/docs/api/apiv3/paths/queries.yml
index b81abcc2625..08d0b4fcb89 100644
--- a/docs/api/apiv3/paths/queries.yml
+++ b/docs/api/apiv3/paths/queries.yml
@@ -1,6 +1,14 @@
# /api/v3/queries
---
get:
+ summary: List queries
+ operationId: List_queries
+ tags:
+ - Queries
+ description: Returns a collection of queries. The collection can be filtered via
+ query parameters similar to how work packages are filtered. Please note however,
+ that the filters are applied to the queries and not to the work packages the queries
+ in turn might return.
parameters:
- description: |-
JSON specifying filter conditions.
@@ -44,15 +52,20 @@ get:
**Required permission:** view work packages or manage public queries in any project
headers: {}
+post:
+ summary: Create query
+ operationId: Create_query
tags:
- Queries
- description: Returns a collection of queries. The collection can be filtered via
- query parameters similar to how work packages are filtered. Please note however,
- that the filters are applied to the queries and not to the work packages the queries
- in turn might return.
- operationId: List_queries
- summary: List queries
-post:
+ 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 Query 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.
+ requestBody:
+ content:
+ application/json:
+ schema:
+ "$ref": "../components/schemas/query_create_form.yml"
responses:
'201':
content:
@@ -94,11 +107,3 @@ post:
* the client provides a link to an invalid resource (`ResourceTypeMismatch`),
e.g. a user, project or operator not found
headers: {}
- tags:
- - Queries
- 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 Query 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.
- operationId: Create_query
- summary: Create query
diff --git a/docs/api/apiv3/paths/queries_form.yml b/docs/api/apiv3/paths/queries_form.yml
index 7ef78ceb869..ff48eff6cb4 100644
--- a/docs/api/apiv3/paths/queries_form.yml
+++ b/docs/api/apiv3/paths/queries_form.yml
@@ -1,12 +1,17 @@
# /api/v3/queries/form
---
post:
+ summary: Query Create Form
+ operationId: Query_Create_Form
+ tags:
+ - Queries
+ description: ''
+ requestBody:
+ content:
+ application/json:
+ schema:
+ "$ref": "../components/schemas/query_create_form.yml"
responses:
'200':
description: OK
headers: {}
- tags:
- - Queries
- description: ''
- operationId: Query_Create_Form
- summary: Query Create Form
diff --git a/docs/api/apiv3/paths/query.yml b/docs/api/apiv3/paths/query.yml
index e4fec677245..543d9216787 100644
--- a/docs/api/apiv3/paths/query.yml
+++ b/docs/api/apiv3/paths/query.yml
@@ -1,6 +1,11 @@
# /api/v3/queries/{id}
---
delete:
+ summary: Delete query
+ operationId: Delete_query
+ tags:
+ - Queries
+ description: Delete the query identified by the id parameter
parameters:
- description: Query id
example: '1'
@@ -49,12 +54,14 @@ delete:
**Required permission:** view work package in queries project
headers: {}
+get:
+ summary: View query
+ operationId: View_query
tags:
- Queries
- description: Delete the query identified by the id parameter
- operationId: Delete_query
- summary: Delete query
-get:
+ description: Retrieve an individual query as identified by the id parameter. Then
+ end point accepts a number of parameters that can be used to override the resources'
+ persisted parameters.
parameters:
- description: Query id
example: '1'
@@ -198,14 +205,14 @@ get:
**Required permission:** view work package in queries project
headers: {}
+patch:
+ summary: Edit Query
+ operationId: Edit_Query
tags:
- Queries
- description: Retrieve an individual query as identified by the id parameter. Then
- end point accepts a number of parameters that can be used to override the resources'
- persisted parameters.
- operationId: View_query
- summary: View query
-patch:
+ description: |-
+ When calling this endpoint the client provides a single object, containing the properties and links that it wants to change, in the body.
+ Note that it is only allowed to provide properties or links supporting the **write** operation.
parameters:
- description: Query id
example: '1'
@@ -214,6 +221,11 @@ patch:
required: true
schema:
type: integer
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '../components/schemas/query_update_form.yml'
responses:
'200':
content:
@@ -380,20 +392,3 @@ patch:
* the client provides a link to an invalid resource (`ResourceTypeMismatch`)
headers: {}
- tags:
- - Queries
- description: |-
- When calling this endpoint the client provides a single object, containing the properties and links that it wants to change, in the body.
- Note that it is only allowed to provide properties or links supporting the **write** operation.
- operationId: Edit_Query
- requestBody:
- content:
- application/json:
- schema:
- example:
- name: New query name
- properties:
- name:
- type: string
- type: object
- summary: Edit Query
diff --git a/docs/api/apiv3/paths/query_form.yml b/docs/api/apiv3/paths/query_form.yml
new file mode 100644
index 00000000000..3ae8d686aeb
--- /dev/null
+++ b/docs/api/apiv3/paths/query_form.yml
@@ -0,0 +1,25 @@
+# /api/v3/query/{id}/form
+---
+post:
+ summary: Query Update Form
+ operationId: Query_Update_Form
+ tags:
+ - Queries
+ description: ''
+ parameters:
+ - description: Query id
+ example: 1
+ in: path
+ name: id
+ required: true
+ schema:
+ type: integer
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '../components/schemas/query_update_form.yml'
+ responses:
+ '200':
+ description: OK
+ headers: {}
diff --git a/docs/api/apiv3/tags/baseline_comparisons.yml b/docs/api/apiv3/tags/baseline_comparisons.yml
index 5a4f3d7b4a2..fd018e333aa 100644
--- a/docs/api/apiv3/tags/baseline_comparisons.yml
+++ b/docs/api/apiv3/tags/baseline_comparisons.yml
@@ -116,7 +116,7 @@ description: |-
The `timestamp` has the same ISO-8601 format as in the `timestamps` request parameter and preserves the absolute or relative character of the requested timestamp.
- Furthermore, each self link corresponding to an earlier point in time has also a `timestamps` request parameter added to it, which is converted to an absolute ISO-8601 string at the execution time of the query. (`"2023-03-01T01:37:10Z` in the above example, which has been executed at that time.)
+ Furthermore, each self link corresponding to an earlier point in time has also a `timestamps` request parameter added to it, which is converted to an absolute ISO-8601 string at the execution time of the query. (in the above example, `PT0S` was converted to `2023-03-01T01:37:10Z` as the query was executed at that time.)
## Attributes