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

[#42173] Add endpoint (API spec) to update cache with live data

Eric Schubert0f01e3d75efa
diff --git a/docs/api/apiv3/components/schemas/user_collection_model.yml b/docs/api/apiv3/components/schemas/user_collection_model.yml
new file mode 100644
index 00000000000..e6aa2ab589d
--- /dev/null
+++ b/docs/api/apiv3/components/schemas/user_collection_model.yml
@@ -0,0 +1,46 @@
+# Schema: UserCollectionModel
+---
+allOf:
+ - $ref: './collection_model.yml'
+ - type: object
+ required:
+ - _links
+ - _embedded
+ properties:
+ _links:
+ type: object
+ required:
+ - self
+ properties:
+ self:
+ allOf:
+ - $ref: "./link.yml"
+ - description: |-
+ This user collection
+
+ **Resource**: UserCollectionModel
+ _embedded:
+ type: object
+ required:
+ - elements
+ properties:
+ elements:
+ type: array
+ items:
+ $ref: './user_model.yml'
+
+example:
+ _type: Collection
+ total: 2
+ count: 2
+ _links:
+ self:
+ href: '/api/v3/users'
+ _embedded:
+ elements:
+ - _hint: User resource shortened for brevity
+ _type: User
+ id: 1337
+ - _hint: User resource shortened for brevity
+ _type: User
+ id: 1338
diff --git a/docs/api/apiv3/components/schemas/user_create_model.yml b/docs/api/apiv3/components/schemas/user_create_model.yml
new file mode 100644
index 00000000000..ea7b8fd9b62
--- /dev/null
+++ b/docs/api/apiv3/components/schemas/user_create_model.yml
@@ -0,0 +1,53 @@
+# Schema: UserCreateModel
+---
+type: object
+required:
+ - admin
+ - email
+ - login
+ - firstName
+ - lastName
+ - language
+properties:
+ admin:
+ type: boolean
+ email:
+ type: string
+ maxLength: 60
+ login:
+ type: string
+ maxLength: 256
+ password:
+ type: string
+ description: |-
+ The users password.
+
+ *Conditions:*
+
+ Only writable on creation, not on update.
+ firstName:
+ type: string
+ maxLength: 30
+ lastName:
+ type: string
+ maxLength: 30
+ status:
+ type: string
+ description: |-
+ The current activation status of the user.
+
+ *Conditions:*
+
+ Only writable on creation, not on update.
+ language:
+ type: string
+
+example:
+ login: j.sheppard
+ password: idestroyedsouvereign
+ firstName: John
+ lastName: Sheppard
+ admin: true
+ status: active
+ language: en
diff --git a/docs/api/apiv3/components/schemas/user_model.yml b/docs/api/apiv3/components/schemas/user_model.yml
index fa1df51640f..ae149a5b771 100644
--- a/docs/api/apiv3/components/schemas/user_model.yml
+++ b/docs/api/apiv3/components/schemas/user_model.yml
@@ -1,42 +1,21 @@
# Schema: UserModel
---
type: object
-example:
- _type: User
- _links:
- self:
- href: "/api/v3/users/1"
- title: j.sheppard
- show:
- href: "/users/1"
- type: text/html
- lock:
- href: "/api/v3/users/1/lock"
- method: POST
- updateImmediately:
- href: "/api/v3/users/1"
- method: PATCH
- delete:
- href: "/api/v3/users/1"
- method: DELETE
- id: 1
- login: j.sheppard
- firstName: John
- lastName: Sheppard
- admin: true
- avatar: https://example.org/users/1/avatar
- status: active
- language: en
- createdAt: '2014-05-21T08:51:20Z'
- updatedAt: '2014-05-21T08:51:20Z'
+required:
+ - _type
+ - id
+ - name
+ - avatar
+ - _links
properties:
+ _type:
+ type: string
+ enum:
+ - User
id:
type: integer
description: User's id
- readOnly: true
minimum: 0
- exclusiveMinimum: true
login:
type: string
description: |-
@@ -67,7 +46,6 @@ properties:
name:
type: string
description: User's full name, formatting depends on instance settings
- readOnly: true
email:
type: string
description: |-
@@ -89,11 +67,9 @@ properties:
type: string
format: uri
description: URL to user's avatar
- readOnly: true
status:
type: string
description: The current activation status of the user (see below)
- readOnly: true
language:
type: string
description: |-
@@ -102,17 +78,9 @@ properties:
# Conditions
**Permission**: Administrator, manage_user global permission
- password:
- type: string
- description: |-
- User's password for the default password authentication
-
- # Conditions
-
- **Permission**: Administrator
- writeOnly: true
- identity_url:
+ identityUrl:
type: string
+ nullable: true
description: |-
User's identity_url for OmniAuth authentication
@@ -123,90 +91,110 @@ properties:
type: string
format: date-time
description: Time of creation
- readOnly: true
updatedAt:
type: string
format: date-time
description: Time of the most recent change to the user
- readOnly: true
_links:
type: object
required:
- - self
+ - self
+ - memberships
+ - showUser
properties:
- lock:
+ self:
allOf:
- - "$ref": "./link.yml"
- - description: |-
- Restrict the user from logging in and performing any actions
-
- # Conditions
-
- not locked; **Permission**: Administrator
- readOnly: true
- show:
+ - "$ref": "./link.yml"
+ - description: |-
+ This user
+
+ **Resource**: User
+ memberships:
allOf:
- - "$ref": "./link.yml"
- - description: Link to the OpenProject user page (HTML)
- readOnly: true
- unlock:
+ - "$ref": "./link.yml"
+ - description: |-
+ Link to collection of all the user's memberships. The list will only include the memberships in projects in which the requesting user has the necessary permissions.
+
+ **Resource**: MemberCollection
+
+ # Conditions
+
+ **Permission**: view members or manage members in any project
+ showUser:
allOf:
- - "$ref": "./link.yml"
- - description: |-
- Allow a locked user to login and act again
-
- # Conditions
-
- locked; **Permission**: Administrator
- readOnly: true
+ - "$ref": "./link.yml"
+ - description: Link to the OpenProject user page (HTML)
updateImmediately:
allOf:
- - "$ref": "./link.yml"
- - description: |-
- Updates the user's attributes.
-
- # Conditions
-
- **Permission**: Administrator, manage_user global permission
- readOnly: true
- delete:
- allOf:
- - "$ref": "./link.yml"
- - description: |-
- Permanently remove a user from the instance
-
- # Conditions
-
- **Permission**: Administrator, self-delete
- readOnly: true
- self:
+ - "$ref": "./link.yml"
+ - description: |-
+ Updates the user's attributes.
+
+ # Conditions
+
+ **Permission**: Administrator, manage_user global permission
+ lock:
allOf:
- - "$ref": "./link.yml"
- - description: |-
- This user
-
- **Resource**: User
- readOnly: true
- auth_source:
+ - "$ref": "./link.yml"
+ - description: |-
+ Restrict the user from logging in and performing any actions
+
+ # Conditions
+
+ not locked; **Permission**: Administrator
+ unlock:
allOf:
- - "$ref": "./link.yml"
- - description: |-
- Link to the user's auth source (endpoint not yet implemented)
-
- **Resource**: AuthSource
-
- # Conditions
-
- **Permission**: Administrator
- members:
+ - "$ref": "./link.yml"
+ - description: |-
+ Allow a locked user to login and act again
+
+ # Conditions
+
+ locked; **Permission**: Administrator
+ delete:
allOf:
- - "$ref": "./link.yml"
- - description: |-
- Link to collection of all the user's memberships. The list will only include the memberships in projects in which the requesting user has the necessary permissions.
+ - "$ref": "./link.yml"
+ - description: |-
+ Permanently remove a user from the instance
+
+ # Conditions
+
+ **Permission**: Administrator, self-delete
- **Resource**: MemberCollection
-
- # Conditions
-
- **Permission**: view members or manage members in any project
- readOnly: true
+example:
+ _type: User
+ id: 1
+ name: John Sheppard
+ login: j.sheppard
+ firstName: John
+ lastName: Sheppard
+ admin: true
+ avatar: https://example.org/users/1/avatar
+ status: active
+ identityUrl: null,
+ language: en
+ createdAt: '2014-05-21T08:51:20Z'
+ updatedAt: '2014-05-21T08:51:20Z'
+ _links:
+ self:
+ href: '/api/v3/users/1'
+ title: John Sheppard
+ memberships:
+ href: /api/v3/memberships?filters=%5B%7B%22principal%22%3A%7B%22operator%22%3A%22%3D%22%2C%22values%22%3A%5B%221%22%5D%7D%7D%5D,
+ title: Members
+ showUser:
+ href: '/users/1'
+ type: text/html
+ lock:
+ href: '/api/v3/users/1/lock'
+ title: Set lock on John Sheppard
+ method: post
+ updateImmediately:
+ href: '/api/v3/users/1'
+ title: update John Sheppard
+ method: patch
+ delete:
+ href: '/api/v3/users/1'
+ title: delete John Sheppard
+ method: delete
diff --git a/docs/api/apiv3/components/schemas/users_model.yml b/docs/api/apiv3/components/schemas/users_model.yml
deleted file mode 100644
index eef18e53820..00000000000
--- a/docs/api/apiv3/components/schemas/users_model.yml
+++ /dev/null
@@ -1,43 +0,0 @@
-# Schema: UsersModel
----
-type: object
-example:
- _links:
- self:
- href: "/api/v3/users"
- total: 2
- count: 1
- _type: Collection
- _embedded:
- elements:
- - _type: User
- _links:
- self:
- href: "/api/v3/users/1"
- title: John Sheppard - j.sheppard
- showUser:
- href: "/users/1"
- type: text/html
- lock:
- href: "/api/v3/users/1/lock"
- title: Set lock on j.sheppard
- method: POST
- update:
- href: "/api/v3/users/1"
- title: Update j.sheppard
- method: PATCH
- delete:
- href: "/api/v3/users/1"
- title: Delete j.sheppard
- method: DELETE
- id: 1
- login: j.sheppard
- firstName: John
- lastName: Sheppard
- admin: true
- avatar: https://example.org/users/1/avatar
- status: active
- language: en
- createdAt: '2014-05-21T08:51:20Z'
- updatedAt: '2014-05-21T08:51:20Z'
diff --git a/docs/api/apiv3/openapi-spec.yml b/docs/api/apiv3/openapi-spec.yml
index 74dddb4bbd1..693b026439c 100644
--- a/docs/api/apiv3/openapi-spec.yml
+++ b/docs/api/apiv3/openapi-spec.yml
@@ -408,6 +408,8 @@ paths:
"$ref": "./paths/work_package_available_watchers.yml"
"/api/v3/work_packages/{id}/file_links":
"$ref": "./paths/work_package_file_links.yml"
+ "/api/v3/work_packages/{id}/update_file_links":
+ "$ref": "./paths/work_package_update_file_links.yml"
"/api/v3/work_packages/{id}/form":
"$ref": "./paths/work_package_form.yml"
"/api/v3/work_packages/{id}/revisions":
@@ -701,6 +703,10 @@ components:
"$ref": "./components/schemas/update_project.yml"
Update_time_entry:
"$ref": "./components/schemas/update_time_entry.yml"
+ UserCollectionModel:
+ "$ref": "./components/schemas/user_collection_model.yml"
+ UserCreateModel:
+ "$ref": "./components/schemas/user_create_model.yml"
UserModel:
"$ref": "./components/schemas/user_model.yml"
UserPreferencesModel:
@@ -711,8 +717,6 @@ components:
"$ref": "./components/schemas/user_create_form.yml"
User_update_form:
"$ref": "./components/schemas/user_update_form.yml"
- UsersModel:
- "$ref": "./components/schemas/users_model.yml"
VersionModel:
"$ref": "./components/schemas/version_model.yml"
Version_create_form:
diff --git a/docs/api/apiv3/paths/user.yml b/docs/api/apiv3/paths/user.yml
index fe43efe822e..cda87fddba7 100644
--- a/docs/api/apiv3/paths/user.yml
+++ b/docs/api/apiv3/paths/user.yml
@@ -1,14 +1,19 @@
# /api/v3/users/{id}
---
delete:
+ summary: Delete user
+ operationId: delete_user
+ description: Permanently deletes the specified user account.
+ tags:
+ - Users
parameters:
- - description: User id
- example: '1'
- in: path
- name: id
- required: true
- schema:
- type: integer
+ - description: User id
+ example: '1'
+ in: path
+ name: id
+ required: true
+ schema:
+ type: integer
responses:
'202':
description: |-
@@ -16,225 +21,145 @@ delete:
Note that the response body is empty as of now. In future versions of the API a body
*might* be returned, indicating the progress of deletion.
- headers: {}
'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 allowed to delete the account of this user.
+ $ref: '../components/schemas/error_response.yml'
+ example:
+ _type: Error
+ errorIdentifier: urn:openproject-org:api:v3:errors:MissingPermission
+ message: You are not allowed to delete the account of this user.
description: |-
Returned if the client does not have sufficient permissions or if deletion of users was disabled in the instance wide settings.
**Required permission:** Administrators only (exception: users might be able to delete their own accounts)
- 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 user does not exist.
+ $ref: '../components/schemas/error_response.yml'
+ example:
+ _type: Error
+ errorIdentifier: urn:openproject-org:api:v3:errors:NotFound
+ message: The specified user does not exist.
description: Returned if the user does not exist.
- headers: {}
- tags:
- - Users
- description: Permanently deletes the specified user account.
- operationId: Delete_user
- summary: Delete user
+
get:
+ summary: View user
+ operationId: view_user
+ description: ''
+ tags:
+ - Users
parameters:
- - description: User id. Use `me` to reference current user, if any.
- example: '1'
- in: path
- name: id
- required: true
- schema:
- type: string
+ - description: User id. Use `me` to reference current user, if any.
+ example: '1'
+ in: path
+ name: id
+ required: true
+ schema:
+ type: string
responses:
'200':
content:
application/hal+json:
- examples:
- response:
- value:
- _links:
- delete:
- href: "/api/v3/users/1"
- method: DELETE
- lock:
- href: "/api/v3/users/1/lock"
- method: POST
- self:
- href: "/api/v3/users/1"
- title: j.sheppard
- show:
- href: "/users/1"
- type: text/html
- updateImmediately:
- href: "/api/v3/users/1"
- method: PATCH
- _type: User
- admin: true
- avatar: https://example.org/users/1/avatar
- createdAt: '2014-05-21T08:51:20Z'
- firstName: John
- id: 1
- language: en
- lastName: Sheppard
- login: j.sheppard
- status: active
- updatedAt: '2014-05-21T08:51:20Z'
schema:
- "$ref": "../components/schemas/user_model.yml"
+ $ref: '../components/schemas/user_model.yml'
description: OK
- 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 user does not exist or you do not have permission
- to view them.
+ $ref: '../components/schemas/error_response.yml'
+ example:
+ _type: Error
+ errorIdentifier: urn:openproject-org:api:v3:errors:NotFound
+ message: The specified user does not exist or you do not have permission to view them.
description: |-
Returned if the user does not exist or if the API user does not have permission to view them.
**Required permission** The user needs to be locked in if the installation is configured to prevent anonymous access
- headers: {}
- tags:
- - Users
- description: ''
- operationId: View_user
- summary: View user
+
patch:
+ summary: Update user
+ operationId: update_user
+ tags:
+ - Users
+ description: |-
+ Updates the user's writable attributes.
+ When calling this endpoint the client provides a single object, containing at least the properties and links that are required, in the body.
parameters:
- - description: User id
- example: '1'
- in: path
- name: id
- required: true
- schema:
- type: integer
+ - description: User id
+ example: '1'
+ in: path
+ name: id
+ required: true
+ schema:
+ type: integer
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '../components/schemas/user_create_model.yml'
responses:
'200':
content:
application/hal+json:
schema:
- "$ref": "../components/schemas/user_model.yml"
+ $ref: '../components/schemas/user_model.yml'
description: OK
- headers: {}
'400':
content:
application/hal+json:
schema:
- $ref: "../components/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.
+ $ref: '../components/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.
- headers: {}
'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 allowed to update the account of this user.
+ $ref: '../components/schemas/error_response.yml'
+ example:
+ _type: Error
+ errorIdentifier: urn:openproject-org:api:v3:errors:MissingPermission
+ message: You are not allowed to update the account of this user.
description: |-
Returned if the client does not have sufficient permissions.
**Required permission:** Administrators, manage_user global permission
- 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 user does not exist or you do not have permission
- to view them.
+ $ref: '../components/schemas/error_response.yml'
+ example:
+ _type: Error
+ errorIdentifier: urn:openproject-org:api:v3:errors:NotFound
+ message: The specified user does not exist or you do not have permission to view them.
description: |-
Returned if the user does not exist or if the API user does not have the necessary permissions to update it.
**Required permission:** Administrators only (exception: users may update their own accounts)
- headers: {}
'422':
content:
application/hal+json:
schema:
- $ref: "../components/schemas/error_response.yml"
- examples:
- response:
- value:
- _embedded:
- details:
- attribute: email
- _type: Error
- errorIdentifier: urn:openproject-org:api:v3:errors:PropertyConstraintViolation
- message: The email address is already taken.
+ $ref: '../components/schemas/error_response.yml'
+ example:
+ _embedded:
+ details:
+ attribute: email
+ _type: Error
+ errorIdentifier: urn:openproject-org:api:v3:errors:PropertyConstraintViolation
+ message: The email address is already taken.
description: |-
Returned if:
* the client tries to modify a read-only property (`PropertyIsReadOnly`)
* a constraint for a property was violated (`PropertyConstraintViolation`)
- headers: {}
- tags:
- - Users
- description: |-
- Updates the user's writable attributes.
- When calling this endpoint the client provides a single object, containing at least the properties and links that are required, in the body.
- operationId: Update_user
- requestBody:
- content:
- application/json:
- schema:
- example:
- admin: true
- firstName: Hans
- language: en
- lastName: Wurst
- login: h.wurst
- properties:
- admin:
- type: boolean
- email:
- type: string
- firstName:
- type: string
- language:
- type: string
- lastName:
- type: string
- login:
- type: string
- type: object
- summary: Update user
diff --git a/docs/api/apiv3/paths/user_lock.yml b/docs/api/apiv3/paths/user_lock.yml
index 4dcb5692ecb..ba49aaa060e 100644
--- a/docs/api/apiv3/paths/user_lock.yml
+++ b/docs/api/apiv3/paths/user_lock.yml
@@ -1,198 +1,115 @@
# /api/v3/users/{id}/lock
---
delete:
+ summary: Unlock user
+ operationId: unlock_user
+ tags:
+ - Users
parameters:
- - description: User id
- example: '1'
- in: path
- name: id
- required: true
- schema:
- type: integer
+ - description: User id
+ example: '1'
+ in: path
+ name: id
+ required: true
+ schema:
+ type: integer
responses:
'200':
content:
application/hal+json:
- examples:
- response:
- value:
- _links:
- delete:
- href: "/api/v3/users/1"
- method: DELETE
- lock:
- href: "/api/v3/users/1/lock"
- method: POST
- self:
- href: "/api/v3/users/1"
- title: j.sheppard
- show:
- href: "/users/1"
- type: text/html
- updateImmediately:
- href: "/api/v3/users/1"
- method: PATCH
- _type: User
- admin: true
- avatar: https://example.org/users/1/avatar
- createdAt: '2014-05-21T08:51:20Z'
- firstName: John
- id: 1
- language: en
- lastName: Sheppard
- login: j.sheppard
- status: active
- updatedAt: '2014-05-21T08:51:20Z'
schema:
- "$ref": "../components/schemas/user_model.yml"
+ $ref: '../components/schemas/user_model.yml'
description: OK
- headers: {}
'400':
content:
application/hal+json:
schema:
- $ref: "../components/schemas/error_response.yml"
- examples:
- response:
- value:
- _type: Error
- errorIdentifier: urn:openproject-org:api:v3:errors:InvalidUserStatusTransition
- message: The current user account status does not allow this operation.
+ $ref: '../components/schemas/error_response.yml'
+ example:
+ _type: Error
+ errorIdentifier: urn:openproject-org:api:v3:errors:InvalidUserStatusTransition
+ message: The current user account status does not allow this operation.
description: |-
Returned if the client tries to unlock a user account whose current status does not allow this transition.
**Required permission:** Administrators only
- headers: {}
'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 allowed to unlock the account of this user.
+ $ref: '../components/schemas/error_response.yml'
+ example:
+ _type: Error
+ errorIdentifier: urn:openproject-org:api:v3:errors:MissingPermission
+ message: You are not allowed to unlock the account of this user.
description: |-
Returned if the client does not have sufficient permissions for unlocking a user.
**Required permission:** Administrators only
- 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 user does not exist.
+ example:
+ _type: Error
+ errorIdentifier: urn:openproject-org:api:v3:errors:NotFound
+ message: The specified user does not exist.
description: Returned if the user does not exist.
- headers: {}
- tags:
- - Users
- description: ''
- operationId: Unlock_user
- summary: Unlock user
+
post:
+ summary: Lock user
+ operationId: lock_user
+ tags:
+ - Users
parameters:
- - description: User id
- example: '1'
- in: path
- name: id
- required: true
- schema:
- type: integer
+ - description: User id
+ example: '1'
+ in: path
+ name: id
+ required: true
+ schema:
+ type: integer
responses:
'200':
content:
application/hal+json:
- examples:
- response:
- value:
- _links:
- delete:
- href: "/api/v3/users/1"
- method: DELETE
- lock:
- href: "/api/v3/users/1/lock"
- method: POST
- self:
- href: "/api/v3/users/1"
- title: j.sheppard
- show:
- href: "/users/1"
- type: text/html
- updateImmediately:
- href: "/api/v3/users/1"
- method: PATCH
- _type: User
- admin: true
- avatar: https://example.org/users/1/avatar
- createdAt: '2014-05-21T08:51:20Z'
- firstName: John
- id: 1
- language: en
- lastName: Sheppard
- login: j.sheppard
- status: active
- updatedAt: '2014-05-21T08:51:20Z'
schema:
- "$ref": "../components/schemas/user_model.yml"
+ $ref: '../components/schemas/user_model.yml'
description: OK
- headers: {}
'400':
content:
application/hal+json:
schema:
- $ref: "../components/schemas/error_response.yml"
- examples:
- response:
- value:
- _type: Error
- errorIdentifier: urn:openproject-org:api:v3:errors:InvalidUserStatusTransition
- message: The current user account status does not allow this operation.
+ $ref: '../components/schemas/error_response.yml'
+ example:
+ _type: Error
+ errorIdentifier: urn:openproject-org:api:v3:errors:InvalidUserStatusTransition
+ message: The current user account status does not allow this operation.
description: |-
Returned if the client tries to lock a user account whose current status does not allow this transition.
**Required permission:** Administrators only
- headers: {}
'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 allowed to lock the account of this user.
+ $ref: '../components/schemas/error_response.yml'
+ example:
+ _type: Error
+ errorIdentifier: urn:openproject-org:api:v3:errors:MissingPermission
+ message: You are not allowed to lock the account of this user.
description: |-
Returned if the client does not have sufficient permissions for locking a user.
**Required permission:** Administrators only
- 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 user does not exist.
+ $ref: '../components/schemas/error_response.yml'
+ example:
+ _type: Error
+ errorIdentifier: urn:openproject-org:api:v3:errors:NotFound
+ message: The specified user does not exist.
description: Returned if the user does not exist.
- headers: {}
- tags:
- - Users
- description: ''
- operationId: Lock_user
- summary: Lock user
diff --git a/docs/api/apiv3/paths/users.yml b/docs/api/apiv3/paths/users.yml
index 213fd332254..22948a297bd 100644
--- a/docs/api/apiv3/paths/users.yml
+++ b/docs/api/apiv3/paths/users.yml
@@ -1,244 +1,157 @@
# /api/v3/users
---
get:
+ summary: List Users
+ operationId: list_Users
+ description: Lists users. Only administrators or users with manage_user global permission have permission to do this.
+ tags:
+ - Users
parameters:
- - description: Page number inside the requested collection.
- example: '25'
- in: query
- name: offset
- required: false
- schema:
- default: 1
- type: integer
- - description: Number of elements to display per page.
- example: '25'
- in: query
- name: pageSize
- required: false
- schema:
- type: integer
- - description: |-
- JSON specifying filter conditions.
- Accepts the same format as returned by the [queries](https://www.openproject.org/docs/api/endpoints/queries/)
- endpoint. Currently supported filters are:
-
- + status: Status the user has
-
- + group: Name of the group in which to-be-listed users are members.
-
- + name: Filter users in whose first or last names, or email addresses the given string occurs.
-
- + login: User's login
- example: '[{ "status": { "operator": "=", "values": ["invited"] } }, { "group":
+ - description: Page number inside the requested collection.
+ example: '25'
+ in: query
+ name: offset
+ required: false
+ schema:
+ default: 1
+ type: integer
+ - description: Number of elements to display per page.
+ example: '25'
+ in: query
+ name: pageSize
+ required: false
+ schema:
+ type: integer
+ - description: |-
+ JSON specifying filter conditions.
+ Accepts the same format as returned by the [queries](https://www.openproject.org/docs/api/endpoints/queries/)
+ endpoint. Currently supported filters are:
+
+ + status: Status the user has
+
+ + group: Name of the group in which to-be-listed users are members.
+
+ + name: Filter users in whose first or last names, or email addresses the given string occurs.
+
+ + login: User's login
+ example: '[{ "status": { "operator": "=", "values": ["invited"] } }, { "group":
{ "operator": "=", "values": ["1"] } }, { "name": { "operator": "=", "values":
- in: query
- name: filters
- required: false
- schema:
- type: string
- - description: |-
- JSON specifying sort criteria.
- Accepts the same format as returned by the [queries](https://www.openproject.org/docs/api/endpoints/queries/) endpoint.
- example: '[["status", "asc"]]'
- in: query
- name: sortBy
- required: false
- schema:
- type: string
- - description: |-
- Comma separated list of properties to include.
- example: 'total,elements/name,elements/self,self'
- in: query
- name: select
- required: false
- schema:
- type: string
+ in: query
+ name: filters
+ required: false
+ schema:
+ type: string
+ - description: |-
+ JSON specifying sort criteria.
+ Accepts the same format as returned by the [queries](https://www.openproject.org/docs/api/endpoints/queries/) endpoint.
+ example: '[["status", "asc"]]'
+ in: query
+ name: sortBy
+ required: false
+ schema:
+ type: string
+ - description: |-
+ Comma separated list of properties to include.
+ example: 'total,elements/name,elements/self,self'
+ in: query
+ name: select
+ required: false
+ schema:
+ type: string
responses:
'200':
content:
application/hal+json:
- examples:
- response:
- value:
- _embedded:
- elements:
- - _links:
- delete:
- href: "/api/v3/users/1"
- method: DELETE
- title: Delete j.sheppard
- lock:
- href: "/api/v3/users/1/lock"
- method: POST
- title: Set lock on j.sheppard
- self:
- href: "/api/v3/users/1"
- title: John Sheppard - j.sheppard
- showUser:
- href: "/users/1"
- type: text/html
- update:
- href: "/api/v3/users/1"
- method: PATCH
- title: Update j.sheppard
- _type: User
- admin: true
- avatar: https://example.org/users/1/avatar
- createdAt: '2014-05-21T08:51:20Z'
- firstName: John
- id: 1
- language: en
- lastName: Sheppard
- login: j.sheppard
- status: active
- updatedAt: '2014-05-21T08:51:20Z'
- _links:
- self:
- href: "/api/v3/users"
- _type: Collection
- count: 1
- total: 2
schema:
- "$ref": "../components/schemas/users_model.yml"
+ $ref: '../components/schemas/user_collection_model.yml'
description: OK
- headers: {}
'400':
content:
application/hal+json:
schema:
- $ref: "../components/schemas/error_response.yml"
- examples:
- response:
- value:
- _type: Error
- errorIdentifier: urn:openproject-org:api:v3:errors:InvalidQuery
- message: Unknown sort column.
+ $ref: '../components/schemas/error_response.yml'
+ example:
+ _type: Error
+ errorIdentifier: urn:openproject-org:api:v3:errors:InvalidQuery
+ message: Unknown sort column.
description: Returned if the client sends an unknown sort column.
- headers: {}
'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 allowed to list users.
+ $ref: '../components/schemas/error_response.yml'
+ example:
+ _type: Error
+ errorIdentifier: urn:openproject-org:api:v3:errors:MissingPermission
+ message: You are not allowed to list users.
description: |-
Returned if the client does not have sufficient permissions.
**Required permission:** Administrator
- headers: {}
- tags:
- - Users
- description: Lists users. Only administrators or users with manage_user global permission
- have permission to do this.
- operationId: List_Users
- summary: List Users
+
post:
+ summary: Create User
+ operationId: create_user
+ tags:
+ - Users
+ description: |-
+ Creates a new user. Only administrators and users with manage_user global permission are allowed to do so.
+ When calling this endpoint the client provides a single object, containing at least the properties and links that are required, in the body.
+
+ Valid values for `status`:
+
+ 1) "active" - In this case a password has to be provided in addition to the other attributes.
+
+ 2) "invited" - In this case nothing but the email address is required. The rest is optional. An invitation will be sent to the user.
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '../components/schemas/user_create_model.yml'
responses:
'201':
content:
application/hal+json:
schema:
- "$ref": "../components/schemas/user_model.yml"
+ $ref: '../components/schemas/user_model.yml'
description: Created
- headers: {}
'400':
content:
application/hal+json:
schema:
- $ref: "../components/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: '../components/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.
'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 allowed to create new users.
+ $ref: '../components/schemas/error_response.yml'
+ example:
+ _type: Error
+ errorIdentifier: urn:openproject-org:api:v3:errors:MissingPermission
+ message: You are not allowed to create new users.
description: |-
Returned if the client does not have sufficient permissions.
**Required permission:** Administrator
- headers: {}
'422':
content:
application/hal+json:
schema:
- $ref: "../components/schemas/error_response.yml"
- examples:
- response:
- value:
- _embedded:
- details:
- attribute: email
- _type: Error
- errorIdentifier: urn:openproject-org:api:v3:errors:PropertyConstraintViolation
- message: The email address is already taken.
+ $ref: '../components/schemas/error_response.yml'
+ example:
+ _embedded:
+ details:
+ attribute: email
+ _type: Error
+ errorIdentifier: urn:openproject-org:api:v3:errors:PropertyConstraintViolation
+ message: The email address is already taken.
description: |-
Returned if:
* a constraint for a property was violated (`PropertyConstraintViolation`)
- headers: {}
- tags:
- - Users
- description: |-
- Creates a new user. Only administrators and users with manage_user global permission are allowed to do so.
- When calling this endpoint the client provides a single object, containing at least the properties and links that are required, in the body.
-
- Valid values for `status`:
-
- 1) "active" - In this case a password has to be provided in addition to the other attributes.
-
- 2) "invited" - In this case nothing but the email address is required. The rest is optional. An invitation will be sent to the user.
-
- operationId: Create_User
- requestBody:
- content:
- application/json:
- schema:
- example:
- admin: false
- firstName: Hans
- language: de
- lastName: Wurst
- login: h.wurst
- password: hunter5
- status: active
- properties:
- admin:
- type: boolean
- email:
- type: string
- firstName:
- type: string
- language:
- type: string
- lastName:
- type: string
- login:
- type: string
- password:
- type: string
- status:
- type: string
- type: object
- summary: Create User
diff --git a/docs/api/apiv3/paths/work_package_update_file_links.yml b/docs/api/apiv3/paths/work_package_update_file_links.yml
new file mode 100644
index 00000000000..26bf20645a0
--- /dev/null
+++ b/docs/api/apiv3/paths/work_package_update_file_links.yml
@@ -0,0 +1,54 @@
+# /api/v3/work_packages/{id}/update_file_links
+---
+post:
+ summary: Updated the origin data of the file links of a work package.
+ operationId: update_work_package_file_links
+ tags:
+ - Work Packages
+ - File links
+ description: |-
+ Updates the origin file data of a all file links within a work package.
+
+ The cached data is updated (overwritten) with the new data. If any data point is not available in the new data, but
+ in the old cache, it is not overwritten.
+
+ After a successful update the client SHOULD retrieve the links of file links again to obtain the new data.
+ parameters:
+ - name: id
+ description: Work package id
+ in: path
+ required: true
+ schema:
+ type: integer
+ example: 1337
+ responses:
+ '204':
+ description: No content
+ '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:** view file links
+
+ *Note that you will only receive this error, if you are at least allowed to see the corresponding work package.*
+ '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