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

[#50729] API schema is missing parameters to create memberships

Eric Schubertab05704dd60c
diff --git a/docs/api/apiv3/components/examples/grid-simple-collection-response.yml b/docs/api/apiv3/components/examples/grid-simple-collection-response.yml
index 692e36c854c..09ce22ed64a 100644
--- a/docs/api/apiv3/components/examples/grid-simple-collection-response.yml
+++ b/docs/api/apiv3/components/examples/grid-simple-collection-response.yml
@@ -1,11 +1,11 @@
# Example: Simple grid collection response
---
value:
- _type: Collection,
- total: 1,
- count: 1,
- pageSize: 30,
- offset: 1,
+ _type: Collection
+ total: 1
+ count: 1
+ pageSize: 30
+ offset: 1
_embedded:
elements:
- _type: Grid
diff --git a/docs/api/apiv3/components/examples/membership-create-request-custom-message.yml b/docs/api/apiv3/components/examples/membership-create-request-custom-message.yml
new file mode 100644
index 00000000000..271692ad410
--- /dev/null
+++ b/docs/api/apiv3/components/examples/membership-create-request-custom-message.yml
@@ -0,0 +1,13 @@
+# Example: Create Membership with a custom notification message
+value:
+ _links:
+ principal:
+ href: '/api/v3/users/14'
+ project:
+ href: '/api/v3/projects/21'
+ roles:
+ - href: '/api/v3/roles/4'
+ _meta:
+ notificationMessage:
+ format: markdown
+ raw: 'Execute Order *66*'
diff --git a/docs/api/apiv3/components/examples/membership-create-request-global-role.yml b/docs/api/apiv3/components/examples/membership-create-request-global-role.yml
new file mode 100644
index 00000000000..a09ee4b520b
--- /dev/null
+++ b/docs/api/apiv3/components/examples/membership-create-request-global-role.yml
@@ -0,0 +1,7 @@
+# Example: Create Membership for a global role
+value:
+ _links:
+ principal:
+ href: '/api/v3/users/14'
+ roles:
+ - href: '/api/v3/roles/4'
diff --git a/docs/api/apiv3/components/examples/membership-create-request-no-notification.yml b/docs/api/apiv3/components/examples/membership-create-request-no-notification.yml
new file mode 100644
index 00000000000..d31471889f8
--- /dev/null
+++ b/docs/api/apiv3/components/examples/membership-create-request-no-notification.yml
@@ -0,0 +1,11 @@
+# Example: Create Membership without notification message
+value:
+ _links:
+ principal:
+ href: '/api/v3/users/14'
+ project:
+ href: '/api/v3/projects/21'
+ roles:
+ - href: '/api/v3/roles/4'
+ _meta:
+ sendNotification: false
diff --git a/docs/api/apiv3/components/examples/membership-form-response.yml b/docs/api/apiv3/components/examples/membership-form-response.yml
new file mode 100644
index 00000000000..66e5f84e991
--- /dev/null
+++ b/docs/api/apiv3/components/examples/membership-form-response.yml
@@ -0,0 +1,37 @@
+# Example: Membership form response
+---
+value:
+ _type: Form
+ _embedded:
+ payload:
+ _meta:
+ notificationMessage:
+ format: markdown
+ raw: '*Hallo*'
+ html: '<p class="op-uc-p"><em>Hallo</em></p>'
+ _links:
+ project:
+ href: '/api/v3/projects/21'
+ title: Death Star v3
+ principal:
+ href: '/api/v3/users/14'
+ title: Mara Jade
+ roles: [ ]
+ schema:
+ _type: Schema
+ _hint: Schema resource shortened for brevity
+ validationErrors:
+ roles:
+ _type: Error
+ errorIdentifier: urn:openproject-org:api:v3:errors:PropertyConstraintViolation
+ message: Roles need to be assigned.
+ _embedded:
+ details:
+ attribute: roles
+ _links:
+ self:
+ href: '/api/v3/memberships/form'
+ method: post
+ validate:
+ href: '/api/v3/memberships/form'
+ method: post
diff --git a/docs/api/apiv3/components/examples/membership-schema-response.yml b/docs/api/apiv3/components/examples/membership-schema-response.yml
new file mode 100644
index 00000000000..e875c2c63b2
--- /dev/null
+++ b/docs/api/apiv3/components/examples/membership-schema-response.yml
@@ -0,0 +1,67 @@
+# Example: Membership schema response
+---
+value:
+ _type: 'Schema'
+ _dependencies: [ ]
+ id:
+ type: 'Integer'
+ name: 'ID'
+ required: true
+ hasDefault: false
+ writable: false
+ options: { }
+ createdAt:
+ type: 'DateTime'
+ name: 'Created on'
+ required: true
+ hasDefault: false
+ writable: false
+ options: { }
+ updatedAt:
+ type: 'DateTime'
+ name: 'Updated on'
+ required: true
+ hasDefault: false
+ writable: false
+ options: { }
+ notificationMessage:
+ type: 'Formattable'
+ name: 'Message'
+ required: false
+ hasDefault: false
+ writable: true
+ options: { }
+ location: '_meta'
+ project:
+ type: 'Project'
+ name: 'Project'
+ required: false
+ hasDefault: false
+ writable: true
+ location: '_links'
+ _links:
+ allowedValues:
+ href: '/api/v3/memberships/available_projects?filters=%5B%7B%22principal%22%3A%7B%22operator%22%3A%22%21%22%2C%22values%22%3A%5B%2214%22%5D%7D%7D%5D'
+ principal:
+ type: 'Principal'
+ name: 'Principal'
+ required: true
+ hasDefault: false
+ writable: true
+ location: '_links'
+ _links:
+ allowedValues:
+ href: '/api/v3/principals?filters=%5B%7B%22status%22%3A%7B%22operator%22%3A%22%21%22%2C%22values%22%3A%5B%223%22%5D%7D%7D%2C%7B%22member%22%3A%7B%22operator%22%3A%22%21%22%2C%22values%22%3A%5B%2221%22%5D%7D%7D%5D'
+ roles:
+ type: '[]Role'
+ name: 'Role'
+ required: true
+ hasDefault: false
+ writable: true
+ location: '_links'
+ _links:
+ allowedValues:
+ href: '/api/v3/roles'
+ _links:
+ self:
+ href: '/api/v3/memberships/schema'
diff --git a/docs/api/apiv3/components/examples/membership-simple-collection-response.yml b/docs/api/apiv3/components/examples/membership-simple-collection-response.yml
new file mode 100644
index 00000000000..671013f2918
--- /dev/null
+++ b/docs/api/apiv3/components/examples/membership-simple-collection-response.yml
@@ -0,0 +1,49 @@
+# Example: Simple membership collection response
+---
+value:
+ _type: Collection
+ total: 2
+ count: 2
+ pageSize: 20
+ offset: 1
+ _embedded:
+ elements:
+ - _type: Membership
+ id: 11
+ createdAt: '2015-03-20T12:56:56Z'
+ updatedAt: '2018-12-20T18:16:11Z'
+ _links:
+ self:
+ href: '/api/v3/memberships/11'
+ title: Darth Vader
+ schema:
+ href: '/api/v3/memberships/schema'
+ update:
+ href: '/api/v3/memberships/11/form'
+ method: post
+ updateImmediately:
+ href: '/api/v3/memberships/11'
+ method: patch
+ project:
+ href: '/api/v3/projects/3'
+ title: Death Start v3
+ principal:
+ href: '/api/v3/users/5'
+ title: Darth Vader
+ roles:
+ - href: '/api/v3/roles/4'
+ title: Sith Lord
+ - _type: Membership
+ id: 12
+ _hint: Membership resource shortened for brevity
+ _links:
+ self:
+ href: '/api/v3/memberships'
+ jumpTo:
+ href: '/api/v3/memberships?filters=%5B%5D&offset=%7Boffset%7D&pageSize=20'
+ templated: true
+ changeSize:
+ href: '/api/v3/memberships?filters=%5B%5D&offset=1&pageSize=%7Bsize%7D'
+ templated: true
+ nextByOffset:
+ href: '/api/v3/memberships?filters=%5B%5D&offset=2&pageSize=20'
diff --git a/docs/api/apiv3/components/examples/membership-simple-response.yml b/docs/api/apiv3/components/examples/membership-simple-response.yml
new file mode 100644
index 00000000000..ba85c9b3a23
--- /dev/null
+++ b/docs/api/apiv3/components/examples/membership-simple-response.yml
@@ -0,0 +1,41 @@
+# Example: Simple membership response
+---
+value:
+ _type: Membership
+ id: 11
+ createdAt: '2015-03-20T12:56:56Z'
+ updatedAt: '2018-12-20T18:16:11Z'
+ _embedded:
+ project:
+ _type: Project
+ id: 3
+ _hint: Project resource shortened for brevity
+ principal:
+ _type: User
+ id: 5
+ _hint: User resource shortened for brevity
+ roles:
+ - _type: Role
+ id: 4
+ _hint: Roles resource shortened for brevity
+ _links:
+ self:
+ href: '/api/v3/memberships/11'
+ title: Darth Vader
+ schema:
+ href: '/api/v3/memberships/schema'
+ update:
+ href: '/api/v3/memberships/11/form'
+ method: post
+ updateImmediately:
+ href: '/api/v3/memberships/11'
+ method: patch
+ project:
+ href: '/api/v3/projects/3'
+ title: Death Start v3
+ principal:
+ href: '/api/v3/users/5'
+ title: Darth Vader
+ roles:
+ - href: '/api/v3/roles/4'
+ title: Sith Lord
diff --git a/docs/api/apiv3/components/responses/invalid_query.yml b/docs/api/apiv3/components/responses/invalid_query.yml
new file mode 100644
index 00000000000..7823b34b863
--- /dev/null
+++ b/docs/api/apiv3/components/responses/invalid_query.yml
@@ -0,0 +1,11 @@
+# Response: InvalidQuery
+---
+description: Occurs when the client did not send a valid JSON object in the request body.
+content:
+ application/hal+json:
+ schema:
+ $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.
diff --git a/docs/api/apiv3/components/responses/invalid_request_body.yml b/docs/api/apiv3/components/responses/invalid_request_body.yml
index a19d70eba15..ce80b3df51f 100644
--- a/docs/api/apiv3/components/responses/invalid_request_body.yml
+++ b/docs/api/apiv3/components/responses/invalid_request_body.yml
@@ -1,11 +1,11 @@
# Response: InvalidRequestBody
---
+description: Returned if the client sends invalid request parameters e.g. filters
content:
application/hal+json:
schema:
$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.
+ errorIdentifier: urn:openproject-org:api:v3:errors:InvalidQuery
+ message: Filters Invalid filter does not exist.
diff --git a/docs/api/apiv3/components/responses/missing_content_type.yml b/docs/api/apiv3/components/responses/missing_content_type.yml
index f76bdb9ec70..291e35c8de9 100644
--- a/docs/api/apiv3/components/responses/missing_content_type.yml
+++ b/docs/api/apiv3/components/responses/missing_content_type.yml
@@ -1,7 +1,8 @@
# Response: MissingContentType
---
+description: Occurs when the client did not send a Content-Type header
content:
text/plain:
schema:
type: string
-description: Occurs when the client did not send a Content-Type header
+ example: 'Missing content-type header'
diff --git a/docs/api/apiv3/components/responses/unsupported_media_type.yml b/docs/api/apiv3/components/responses/unsupported_media_type.yml
index 629cfe28d71..a75b5ed9751 100644
--- a/docs/api/apiv3/components/responses/unsupported_media_type.yml
+++ b/docs/api/apiv3/components/responses/unsupported_media_type.yml
@@ -1,5 +1,6 @@
# Response: UnsupportedMediaType
---
+description: Occurs when the client sends an unsupported Content-Type header.
content:
application/hal+json:
schema:
@@ -8,4 +9,3 @@ content:
_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.
diff --git a/docs/api/apiv3/components/schemas/available_projects_for_memberships_model.yml b/docs/api/apiv3/components/schemas/available_projects_for_memberships_model.yml
deleted file mode 100644
index 19d693ff563..00000000000
--- a/docs/api/apiv3/components/schemas/available_projects_for_memberships_model.yml
+++ /dev/null
@@ -1,63 +0,0 @@
-# Schema: Available_projects_for_membershipsModel
----
-type: object
-example:
- _links:
- self:
- href: "/api/v3/memberships/available_projects"
- _type: Collection
- total: 2
- count: 2
- _embedded:
- elements:
- - _type: Project
- _links:
- self:
- href: "/api/v3/projects/6"
- title: A project
- editWorkPackage:
- href: "/api/v3/work_packages/{id}/form"
- templated: true
- method: post
- createWorkPackage:
- href: "/api/v3/projects/6/work_packages/form"
- method: post
- createWorkPackageImmediate:
- href: "/api/v3/projects/6/work_packages"
- method: post
- categories:
- href: "/api/v3/projects/6/categories"
- memberships:
- href: "/api/v3/projects/6/memberships"
- id: 6
- identifier: a_project
- name: A project
- description: Eveniet molestias omnis quis aut qui eum adipisci. Atque aut aut
- in exercitationem adipisci amet. Nisi asperiores quia ratione veritatis enim
- exercitationem magnam. Aut fuga architecto adipisci nihil. Et repellat pariatur.
- Aliquam et sed perferendis nostrum quaerat. Fugit doloremque voluptatem.
- createdAt: '2015-07-06T13:28:14+00:00'
- updatedAt: '2015-10-01T09:55:02+00:00'
- type: Customer Project
- - _type: Project
- _links:
- self:
- href: "/api/v3/projects/14"
- title: Another project
- createWorkPackage:
- href: "/api/v3/projects/14/work_packages/form"
- method: post
- createWorkPackageImmediate:
- href: "/api/v3/projects/14/work_packages"
- method: post
- categories:
- href: "/api/v3/projects/14/categories"
- memberships:
- href: "/api/v3/projects/14/memberships"
- id: 14
- identifier: another_project
- name: Another project
- description: ''
- createdAt: '2016-02-29T12:50:20+00:00'
- updatedAt: '2016-02-29T12:50:20+00:00'
- type:
diff --git a/docs/api/apiv3/components/schemas/list_memberships_model.yml b/docs/api/apiv3/components/schemas/list_memberships_model.yml
deleted file mode 100644
index f11f42a49ab..00000000000
--- a/docs/api/apiv3/components/schemas/list_memberships_model.yml
+++ /dev/null
@@ -1,48 +0,0 @@
-# Schema: List_membershipsModel
----
-type: object
-example:
- _links:
- self:
- href: "/api/v3/memberships"
- total: 2
- count: 2
- _type: Collection
- _embedded:
- elements:
- - _links:
- self:
- href: "/api/v3/memberships/11"
- schema:
- href: "/api/v3/memberships/schema"
- project:
- href: "/api/v3/projects/3"
- title: A Project
- principal:
- href: "/api/v3/users/5"
- title: A user
- roles:
- - href: "/api/v3/roles/4"
- title: Reader
- _type: Membership
- id: 11
- createdAt: '2015-03-20T12:56:56Z'
- updatedAt: '2018-12-20T18:16:11Z'
- - _links:
- self:
- href: "/api/v3/memberships/41"
- schema:
- href: "/api/v3/memberships/schema"
- project:
- href: "/api/v3/projects/6"
- title: Another Project
- principal:
- href: "/api/v3/groups/5"
- title: A group
- roles:
- - href: "/api/v3/roles/8"
- title: Project admin
- _type: Membership
- id: 41
- createdAt: '2019-12-22T12:56:06Z'
- updatedAt: '2020-12-20T18:16:12Z'
diff --git a/docs/api/apiv3/components/schemas/membership_collection_model.yml b/docs/api/apiv3/components/schemas/membership_collection_model.yml
new file mode 100644
index 00000000000..02a10fce13c
--- /dev/null
+++ b/docs/api/apiv3/components/schemas/membership_collection_model.yml
@@ -0,0 +1,18 @@
+# Schema: MembershipCollectionModel
+---
+allOf:
+ - $ref: './paginated_collection_model.yml'
+ - type: object
+ required:
+ - _embedded
+ properties:
+ _embedded:
+ type: object
+ required:
+ - elements
+ properties:
+ elements:
+ type: array
+ items:
+ $ref: './membership_read_model.yml'
+
diff --git a/docs/api/apiv3/components/schemas/membership_form_model.yml b/docs/api/apiv3/components/schemas/membership_form_model.yml
new file mode 100644
index 00000000000..cd07c985acf
--- /dev/null
+++ b/docs/api/apiv3/components/schemas/membership_form_model.yml
@@ -0,0 +1,60 @@
+# Schema: MembershipFormModel
+---
+type: object
+required:
+ - _type
+ - _embedded
+ - _links
+properties:
+ _type:
+ type: string
+ enum:
+ - Form
+ _embedded:
+ type: object
+ required:
+ - payload
+ - schema
+ - validationError
+ properties:
+ payload:
+ $ref: './membership_write_model.yml'
+ schema:
+ $ref: './membership_schema_model.yml'
+ validationError:
+ type: object
+ properties:
+ base:
+ $ref: './error_response.yml'
+ principal:
+ $ref: './error_response.yml'
+ roles:
+ $ref: './error_response.yml'
+ _links:
+ type: object
+ required:
+ - self
+ - validate
+ - commit
+ properties:
+ self:
+ allOf:
+ - $ref: './link.yml'
+ - description: |-
+ This form request.
+
+ **Resource**: Form
+ validate:
+ type: array
+ items:
+ allOf:
+ - $ref: './link.yml'
+ - description: |-
+ The endpoint to validate the membership payload.
+ commit:
+ allOf:
+ - $ref: './link.yml'
+ - description: |-
+ The endpoint to create the membership with the same payload, as sent to the form.
+
+ **Resource**: Membership
diff --git a/docs/api/apiv3/components/schemas/membership_read_model.yml b/docs/api/apiv3/components/schemas/membership_read_model.yml
new file mode 100644
index 00000000000..83a44b87ce2
--- /dev/null
+++ b/docs/api/apiv3/components/schemas/membership_read_model.yml
@@ -0,0 +1,104 @@
+# Schema: MembershipReadModel
+---
+type: object
+required:
+ - _type
+ - id
+ - createdAt
+ - updatedAt
+ - _links
+properties:
+ _type:
+ type: string
+ enum:
+ - Membership
+ id:
+ type: integer
+ description: The membership's id
+ minimum: 1
+ createdAt:
+ type: string
+ format: date-time
+ description: The time the membership was created.
+ updatedAt:
+ type: string
+ format: date-time
+ description: The time the membership was last updated.
+ _embedded:
+ type: object
+ properties:
+ project:
+ $ref: './project_model.yml'
+ principal:
+ anyOf:
+ - $ref: './user_model.yml'
+ - $ref: './group_model.yml'
+ roles:
+ type: array
+ items:
+ $ref: './role_model.yml'
+ _links:
+ type: object
+ required:
+ - self
+ - schema
+ - project
+ - principal
+ - roles
+ properties:
+ self:
+ allOf:
+ - $ref: './link.yml'
+ - description: |-
+ This membership.
+
+ **Resource**: Membership
+ schema:
+ allOf:
+ - $ref: './link.yml'
+ - description: |-
+ This membership schema.
+
+ **Resource**: Schema
+ update:
+ allOf:
+ - $ref: './link.yml'
+ - description: |-
+ The endpoint for updating the membership.
+
+ # Conditions
+
+ **Permission**: manage_members
+ updateImmediately:
+ allOf:
+ - $ref: './link.yml'
+ - description: |-
+ The endpoint for updating the membership without form validation.
+
+ # Conditions
+
+ **Permission**: manage_members
+ project:
+ allOf:
+ - $ref: './link.yml'
+ - description: |-
+ The project the membership is related to.
+
+ **Resource**: Project
+ principal:
+ allOf:
+ - $ref: './link.yml'
+ - description: |-
+ The principal the membership is related to.
+
+ **Resource**: Principal
+ roles:
+ type: array
+ items:
+ allOf:
+ - $ref: './link.yml'
+ - description: |-
+ A role the principal has.
+
+ **Resource**: Role
+
diff --git a/docs/api/apiv3/components/schemas/membership_schema_model.yml b/docs/api/apiv3/components/schemas/membership_schema_model.yml
new file mode 100644
index 00000000000..25514ed405d
--- /dev/null
+++ b/docs/api/apiv3/components/schemas/membership_schema_model.yml
@@ -0,0 +1,28 @@
+# Schema: MembershipSchemaModel
+---
+allOf:
+ - $ref: './schema_model.yml'
+ - type: object
+ required:
+ - id
+ - createdAt
+ - updatedAt
+ - notificationMessage
+ - project
+ - principal
+ - roles
+ properties:
+ id:
+ $ref: './schema_property_model.yml'
+ createdAt:
+ $ref: './schema_property_model.yml'
+ updatedAt:
+ $ref: './schema_property_model.yml'
+ notificationMessage:
+ $ref: './schema_property_model.yml'
+ project:
+ $ref: './schema_property_model.yml'
+ principal:
+ $ref: './schema_property_model.yml'
+ roles:
+ $ref: './schema_property_model.yml'
diff --git a/docs/api/apiv3/components/schemas/membership_write_model.yml b/docs/api/apiv3/components/schemas/membership_write_model.yml
new file mode 100644
index 00000000000..a2d035417c2
--- /dev/null
+++ b/docs/api/apiv3/components/schemas/membership_write_model.yml
@@ -0,0 +1,47 @@
+# Schema: MembershipWriteModel
+---
+type: object
+required:
+ - _links
+properties:
+ _links:
+ type: object
+ required:
+ - principal
+ - roles
+ properties:
+ principal:
+ allOf:
+ - $ref: './link.yml'
+ - description: |-
+ The principal that is to get a membership.
+
+ **Resource**: Principal
+ roles:
+ type: array
+ items:
+ allOf:
+ - $ref: './link.yml'
+ - description: |-
+ A role the principal has.
+
+ **Resource**: Role
+ project:
+ allOf:
+ - $ref: './link.yml'
+ - description: |-
+ The project that is to get a membership. If no project is given, the principal's membership is supposed
+ to be global.
+
+ **Resource**: Project
+ _meta:
+ type: object
+ properties:
+ notificationMessage:
+ allOf:
+ - $ref: './formattable.yml'
+ - description: A customised notification message, which will overwrite the standard notification.
+ sendNotification:
+ type: boolean
+ description: Set to false, if no notification should get sent.
+ default: true
diff --git a/docs/api/apiv3/components/schemas/schema_model.yml b/docs/api/apiv3/components/schemas/schema_model.yml
index 3ed68116467..c75d2e12a60 100644
--- a/docs/api/apiv3/components/schemas/schema_model.yml
+++ b/docs/api/apiv3/components/schemas/schema_model.yml
@@ -19,9 +19,8 @@ properties:
properties:
self:
allOf:
- - "$ref": "./link.yml"
- - description: |-
- This schema
-
- **Resource**: Schema
- readOnly: true
+ - $ref: './link.yml'
+ - description: |-
+ This schema
+
+ **Resource**: Schema
diff --git a/docs/api/apiv3/components/schemas/schema_property_model.yml b/docs/api/apiv3/components/schemas/schema_property_model.yml
new file mode 100644
index 00000000000..e76ad67d7a9
--- /dev/null
+++ b/docs/api/apiv3/components/schemas/schema_property_model.yml
@@ -0,0 +1,36 @@
+# Schema: SchemaModel
+---
+type: object
+required:
+ - type
+ - name
+ - required
+ - hasDefault
+ - writable
+properties:
+ type:
+ type: string
+ description: The resource type for this property.
+ name:
+ type: string
+ description: The name of the property.
+ required:
+ type: boolean
+ description: Indicates, if the property is required for submitting a request of this schema.
+ hasDefault:
+ type: boolean
+ description: Indicates, if the property has a default.
+ writable:
+ type: boolean
+ description: Indicates, if the property is writable when sending a request of this schema.
+ object:
+ type: object
+ description: Additional options for the property.
+ location:
+ type: string
+ description: Defines the json path where the property is located in the payload.
+ default: ''
+ _links:
+ type: object
+ description: Useful links for this property (e.g. an endpoint to fetch allowed values)
+
diff --git a/docs/api/apiv3/components/schemas/view_membership_model.yml b/docs/api/apiv3/components/schemas/view_membership_model.yml
deleted file mode 100644
index 8eaf6f5d4aa..00000000000
--- a/docs/api/apiv3/components/schemas/view_membership_model.yml
+++ /dev/null
@@ -1,35 +0,0 @@
-# Schema: View_membershipModel
----
-type: object
-example:
- _links:
- self:
- href: "/api/v3/memberships/11"
- title: Some user
- schema:
- href: "/api/v3/memberships/schema"
- update:
- href: "/api/v3/memberships/11/form"
- method: post
- updateImmediately:
- href: "/api/v3/memberships/11"
- method: patch
- project:
- href: "/api/v3/projects/3"
- title: A project
- principal:
- href: "/api/v3/users/4"
- title: Some user
- roles:
- - href: "/api/v3/roles/5"
- title: Member
- - href: "/api/v3/roles/4"
- title: Reader
- _type: Membership
- id: 11
- createdAt: '2015-03-20T12:56:56Z'
- updatedAt: '2018-12-20T18:16:11Z'
- _embedded:
- project...: {}
- principal...: {}
- roles...: []
diff --git a/docs/api/apiv3/components/schemas/view_membership_schema_model.yml b/docs/api/apiv3/components/schemas/view_membership_schema_model.yml
deleted file mode 100644
index 8cfcf80cd99..00000000000
--- a/docs/api/apiv3/components/schemas/view_membership_schema_model.yml
+++ /dev/null
@@ -1,59 +0,0 @@
-# Schema: View_membership_schemaModel
----
-type: object
-example:
- _type: Schema
- _dependencies: []
- id:
- type: Integer
- name: ID
- required: true
- hasDefault: false
- writable: false
- createdAt:
- type: DateTime
- name: Created on
- required: true
- hasDefault: false
- writable: false
- updatedAt:
- type: DateTime
- name: Updated on
- required: true
- hasDefault: false
- writable: false
- notificationMessage:
- type: Formattable
- name: Message
- required: false
- hasDefault: false
- writable: true
- options: {}
- location: _meta
- project:
- type: Project
- name: Project
- required: false
- hasDefault: false
- writable: true
- location: _links
- _links: {}
- principal:
- type: Principal
- name: Principal
- required: true
- hasDefault: false
- writable: true
- location: _links
- _links: {}
- roles:
- type: "[]Role"
- name: Role
- required: true
- hasDefault: false
- writable: true
- location: _links
- _links: {}
- _links:
- self:
- href: "/api/v3/memberships/schema"
diff --git a/docs/api/apiv3/openapi-spec.yml b/docs/api/apiv3/openapi-spec.yml
index 92f4c45af39..84d8920b2dc 100644
--- a/docs/api/apiv3/openapi-spec.yml
+++ b/docs/api/apiv3/openapi-spec.yml
@@ -473,6 +473,20 @@ components:
"$ref": "./components/examples/grid-simple-patch-model.yml"
GridSimpleResponse:
"$ref": "./components/examples/grid-simple-response.yml"
+ MembershipCreateRequestCustomMessage:
+ "$ref": "./components/examples/membership-create-request-custom-message.yml"
+ MembershipCreateRequestGlobalRole:
+ "$ref": "./components/examples/membership-create-request-global-role.yml"
+ MembershipCreateRequestNoNotification:
+ "$ref": "./components/examples/membership-create-request-no-notification.yml"
+ MembershipFormResponse:
+ "$ref": "./components/examples/membership-form-response.yml"
+ MembershipSchemaResponse:
+ "$ref": "./components/examples/membership-schema-response.yml"
+ MembershipSimpleCollectionResponse:
+ "$ref": "./components/examples/membership-simple-collection-response.yml"
+ MembershipSimpleResponse:
+ "$ref": "./components/examples/membership-simple-response.yml"
MentionedNotification:
$ref: './components/examples/mentioned_notification.yml'
NotificationCollection:
@@ -509,6 +523,8 @@ components:
"$ref": "./components/examples/view_team_planner.yml"
responses:
+ InvalidQuery:
+ "$ref": "./components/responses/invalid_query.yml"
InvalidRequestBody:
"$ref": "./components/responses/invalid_request_body.yml"
MissingContentType:
@@ -529,8 +545,6 @@ components:
"$ref": "./components/schemas/available_responsibles_model.yml"
Available_WatchersModel:
"$ref": "./components/schemas/available_watchers_model.yml"
- Available_projects_for_membershipsModel:
- "$ref": "./components/schemas/available_projects_for_memberships_model.yml"
Available_projects_for_queryModel:
"$ref": "./components/schemas/available_projects_for_query_model.yml"
Available_projects_for_time_entriesModel:
@@ -613,8 +627,6 @@ components:
"$ref": "./components/schemas/list_available_parent_project_candidates_model.yml"
List_capabilitiesModel:
"$ref": "./components/schemas/list_capabilities_model.yml"
- List_membershipsModel:
- "$ref": "./components/schemas/list_memberships_model.yml"
List_of_NewsModel:
"$ref": "./components/schemas/list_of_news_model.yml"
List_projectsModel:
@@ -623,6 +635,16 @@ components:
"$ref": "./components/schemas/list_projects_by_version_model.yml"
MarkdownModel:
"$ref": "./components/schemas/markdown_model.yml"
+ MembershipCollectionModel:
+ "$ref": "./components/schemas/membership_collection_model.yml"
+ MembershipFormModel:
+ "$ref": "./components/schemas/membership_form_model.yml"
+ MembershipReadModel:
+ "$ref": "./components/schemas/membership_read_model.yml"
+ MembershipSchemaModel:
+ "$ref": "./components/schemas/membership_schema_model.yml"
+ MembershipWriteModel:
+ "$ref": "./components/schemas/membership_write_model.yml"
NewsModel:
"$ref": "./components/schemas/news_model.yml"
NonWorkingDayCollectionModel:
@@ -701,6 +723,8 @@ components:
"$ref": "./components/schemas/root_model.yml"
SchemaModel:
"$ref": "./components/schemas/schema_model.yml"
+ SchemaPropertyModel:
+ "$ref": "./components/schemas/schema_property_model.yml"
Schema_For_Global_QueriesModel:
"$ref": "./components/schemas/schema_for_global_queries_model.yml"
Schema_For_Project_QueriesModel:
@@ -763,10 +787,6 @@ components:
"$ref": "./components/schemas/view_capabilities_model.yml"
View_global_contextModel:
"$ref": "./components/schemas/view_global_context_model.yml"
- View_membershipModel:
- "$ref": "./components/schemas/view_membership_model.yml"
- View_membership_schemaModel:
- "$ref": "./components/schemas/view_membership_schema_model.yml"
View_project_statusModel:
"$ref": "./components/schemas/view_project_status_model.yml"
View_time_entry_schemaModel:
diff --git a/docs/api/apiv3/paths/grids.yml b/docs/api/apiv3/paths/grids.yml
index ff248dc87f9..c268a214a61 100644
--- a/docs/api/apiv3/paths/grids.yml
+++ b/docs/api/apiv3/paths/grids.yml
@@ -45,18 +45,10 @@ get:
schema:
$ref: '../components/schemas/grid_collection_model.yml'
examples:
- 'Simple grid':
+ 'Simple grid collection':
$ref: '../components/examples/grid-simple-collection-response.yml'
'400':
- description: Returned if the client sends invalid request parameters e.g. filters
- content:
- application/hal+json:
- schema:
- $ref: '../components/schemas/error_response.yml'
- example:
- _type: Error
- errorIdentifier: urn:openproject-org:api:v3:errors:InvalidQuery
- message: Filters Invalid filter does not exist.
+ $ref: '../components/responses/invalid_query.yml'
'403':
description: Returned if the client is not logged in and login is required.
content:
diff --git a/docs/api/apiv3/paths/membership.yml b/docs/api/apiv3/paths/membership.yml
index 3b84e2cc23a..c59c100b0f0 100644
--- a/docs/api/apiv3/paths/membership.yml
+++ b/docs/api/apiv3/paths/membership.yml
@@ -1,45 +1,44 @@
# /api/v3/memberships/{id}
---
delete:
+ summary: Delete membership
+ operationId: delete_membership
+ tags:
+ - Memberships
+ description: Deletes the membership.
parameters:
- - description: Membership id
- example: '1'
- in: path
- name: id
- required: true
- schema:
- type: integer
+ - name: id
+ description: Membership id
+ in: path
+ required: true
+ example: 1
+ schema:
+ type: integer
responses:
'204':
description: Returned if the membership was successfully deleted
- 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 authorized to access this resource.
description: |-
Returned if the client does not have sufficient permissions.
**Required permission:** manage members
- headers: {}
+ 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.
'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 requested resource could not be found.
+ $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 membership does not exist or the client does not have sufficient permissions
to see it.
@@ -48,78 +47,44 @@ delete:
*Note: A client without sufficient permissions shall not be able to test for the existence of
a version. 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"
+ $ref: '../components/responses/missing_content_type.yml'
'415':
- $ref: "../components/responses/unsupported_media_type.yml"
- tags:
- - Memberships
- description: Deletes the membership.
- operationId: Delete_membership
- summary: Delete membership
+ $ref: '../components/responses/unsupported_media_type.yml'
+
get:
+ summary: Get a membership
+ operationId: get_membership
+ description: Retrieves a membership resource identified by the given id.
+ tags:
+ - Memberships
parameters:
- - description: Membership id
- example: '1'
- in: path
- name: id
- required: true
- schema:
- type: integer
+ - name: id
+ description: Membership id
+ in: path
+ required: true
+ example: 1
+ schema:
+ type: integer
responses:
'200':
+ description: OK
content:
application/hal+json:
- examples:
- response:
- value:
- _embedded:
- principal...: {}
- project...: {}
- roles...: []
- _links:
- principal:
- href: "/api/v3/users/4"
- title: Some user
- project:
- href: "/api/v3/projects/3"
- title: A project
- roles:
- - href: "/api/v3/roles/5"
- title: Member
- - href: "/api/v3/roles/4"
- title: Reader
- schema:
- href: "/api/v3/memberships/schema"
- self:
- href: "/api/v3/memberships/11"
- title: Some user
- update:
- href: "/api/v3/memberships/11/form"
- method: post
- updateImmediately:
- href: "/api/v3/memberships/11"
- method: patch
- _type: Membership
- createdAt: '2015-03-20T12:56:56Z'
- id: 11
- updatedAt: '2018-12-20T18:16:11Z'
schema:
- "$ref": "../components/schemas/view_membership_model.yml"
- description: OK
- headers: {}
+ $ref: '../components/schemas/membership_read_model.yml'
+ examples:
+ 'simple membership':
+ $ref: '../components/examples/membership-simple-response.yml'
'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 requested resource could not be found.
+ $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 membership does not exist or the client does not have sufficient permissions
to see it.
@@ -128,58 +93,62 @@ get:
*Note: A client without sufficient permissions shall not be able to test for the existence of
a membership. That's why a 404 is returned here, even if a 403 might be more appropriate.*
- headers: {}
- tags:
- - Memberships
- description: ''
- operationId: View_membership
- summary: View membership
+
patch:
+ summary: Update membership
+ operationId: update_membership
+ description: |-
+ Updates the given membership by applying the attributes provided in the body.
+
+ By providing a `notificationMessage` within the `_meta` block of the payload, the client can include a customized message to the user
+ of the updated membership. In case of a group, the message will be sent to every user belonging to the group.
+
+ By including `{ "sendNotifications": false }` within the `_meta` block of the payload, no notifications is send out at all.
+ tags:
+ - Memberships
parameters:
- - description: Membership id
- example: '1'
- in: path
- name: id
- required: true
- schema:
- type: integer
+ - name: id
+ description: Membership id
+ in: path
+ required: true
+ example: 1
+ schema:
+ type: integer
responses:
'200':
+ description: OK
content:
application/hal+json:
schema:
- "$ref": "../components/schemas/view_membership_model.yml"
- description: OK
- headers: {}
+ $ref: '../components/schemas/membership_read_model.yml'
+ examples:
+ 'simple membership':
+ $ref: '../components/examples/membership-simple-response.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"
- examples:
- response:
- value:
- _type: Error
- errorIdentifier: urn:openproject-org:api:v3:errors:MissingPermission
- message: You are not authorized to access this resource.
+ $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 members in the membership's project.
- headers: {}
+ 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 requested resource could not be found.
+ $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 membership does not exist or the client does not have sufficient permissions
to see it.
@@ -188,38 +157,23 @@ patch:
*Note: A client without sufficient permissions shall not be able to test for the existence of
a version. 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"
+ $ref: '../components/responses/missing_content_type.yml'
'415':
- $ref: "../components/responses/unsupported_media_type.yml"
+ $ref: '../components/responses/unsupported_media_type.yml'
'422':
content:
application/hal+json:
schema:
- $ref: "../components/schemas/error_response.yml"
- examples:
- response:
- value:
- _embedded:
- details:
- attribute: roles
- _type: Error
- errorIdentifier: urn:openproject-org:api:v3:errors:PropertyConstraintViolation
- message: Roles has an unassignable role.
+ $ref: '../components/schemas/error_response.yml'
+ example:
+ _embedded:
+ details:
+ attribute: roles
+ _type: Error
+ errorIdentifier: urn:openproject-org:api:v3:errors:PropertyConstraintViolation
+ message: Roles has an unassignable role.
description: |-
Returned if:
* a constraint for a property was violated (`PropertyConstraintViolation`)
- headers: {}
- tags:
- - Memberships
- description: |-
- Updates the given membership by applying the attributes provided in the body.
-
- By providing a `notificationMessage` within the `_meta` block of the payload, the client can include a customized message to the user
- of the updated membership. In case of a group, the message will be sent to every user belonging to the group.
-
- By including `{ "sendNotifications": false }` within the `_meta` block of the payload, no notifications is send out at all.
- operationId: Update_membership
- summary: Update membership
diff --git a/docs/api/apiv3/paths/membership_form.yml b/docs/api/apiv3/paths/membership_form.yml
index 52559eb46dc..eb9914e3652 100644
--- a/docs/api/apiv3/paths/membership_form.yml
+++ b/docs/api/apiv3/paths/membership_form.yml
@@ -1,122 +1,57 @@
# /api/v3/memberships/{id}/form
---
post:
+ summary: Form update membership
+ operationId: form_update_membership
+ tags:
+ - Memberships
+ description: |-
+ Requests and validates the update form for a membership identified by the given id. The request payload, if sent,
+ is validated. The form endpoint itself does not change the membership.
parameters:
- - description: Membership id
- example: '1'
- in: path
- name: id
- required: true
- schema:
- type: integer
+ - name: id
+ description: Membership id
+ in: path
+ required: true
+ example: 1
+ schema:
+ type: integer
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '../components/schemas/membership_write_model.yml'
+ examples:
+ 'no notification':
+ $ref: '../components/examples/membership-create-request-no-notification.yml'
+ 'custom message':
+ $ref: '../components/examples/membership-create-request-custom-message.yml'
responses:
'200':
+ description: OK
content:
application/hal+json:
+ schema:
+ $ref: '../components/schemas/membership_read_model.yml'
examples:
- response:
- value:
- _embedded:
- payload:
- _links:
- roles:
- - href: "/api/v3/roles/4"
- title: A role
- _meta:
- notificationMessage:
- raw: Alice, you can now also create work packages.
- schema:
- _dependencies: []
- _links: {}
- _type: Schema
- createdAt:
- hasDefault: false
- name: Created on
- required: true
- type: DateTime
- writable: false
- id:
- hasDefault: false
- name: ID
- required: true
- type: Integer
- writable: false
- notificationMessage:
- hasDefault: false
- location: _meta
- name: Message
- options: {}
- required: false
- type: Formattable
- writable: true
- principal:
- _links: {}
- hasDefault: false
- name: Principal
- required: true
- type: Principal
- writable: false
- project:
- _links: {}
- hasDefault: false
- name: Project
- required: false
- type: Project
- writable: false
- roles:
- _links:
- allowedValues:
- href: "/api/v3/roles?filters=%5B%7B%22unit%22%3A%7B%22operator%22%3A%22%3D%22%2C%22values%22%3A%5B%22project%22%5D%7D%7D%5D"
- hasDefault: false
- location: _links
- name: Role
- required: true
- type: "[]Role"
- writable: true
- updatedAt:
- hasDefault: false
- name: Updated on
- required: true
- type: DateTime
- writable: false
- validationErrors: {}
- _links:
- commit:
- href: "/api/v3/memberships/5"
- method: patch
- self:
- href: "/api/v3/memberships/5/form"
- method: post
- validate:
- href: "/api/v3/memberships/5/form"
- method: post
- _type: Form
- description: OK
- headers: {}
+ 'simple membership':
+ $ref: '../components/examples/membership-simple-response.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"
- examples:
- response:
- value:
- _type: Error
- errorIdentifier: urn:openproject-org:api:v3:errors:MissingPermission
- message: You are not authorized to access this resource.
+ $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 versions in the version's project
- headers: {}
'406':
- $ref: "../components/responses/missing_content_type.yml"
+ $ref: '../components/responses/missing_content_type.yml'
'415':
- $ref: "../components/responses/unsupported_media_type.yml"
- tags:
- - Memberships
- description: ''
- operationId: Membership_update_form
- summary: Membership update form
+ $ref: '../components/responses/unsupported_media_type.yml'
diff --git a/docs/api/apiv3/paths/memberships.yml b/docs/api/apiv3/paths/memberships.yml
index af4c730d96f..4fa8a207c20 100644
--- a/docs/api/apiv3/paths/memberships.yml
+++ b/docs/api/apiv3/paths/memberships.yml
@@ -1,144 +1,137 @@
# /api/v3/memberships
---
get:
+ summary: List memberships
+ operationId: list_memberships
+ tags:
+ - Memberships
+ description: |-
+ Returns a collection of memberships. The client can choose to filter
+ the memberships similar to how work packages are filtered. In addition to the
+ provided filters, the server will reduce the result set to only contain memberships,
+ for which the requesting client has sufficient permissions (*view_members*, *manage_members*).
parameters:
- - 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:
-
- + any_name_attribute: filters memberships based on the name of the principal. All possible name variants (and also email and login) are searched.
-
- + blocked: reduces the result set to all memberships that are temporarily blocked or that are not blocked temporarily.
-
- + group: filters memberships based on the name of a group. The group however is not the principal used for filtering. Rather, the memberships of the group are used as the filter values.
-
- + name: filters memberships based on the name of the principal. Note that only the name is used which depends on a setting in the OpenProject instance.
-
- + principal: filters memberships based on the id of the principal.
-
- + project: filters memberships based on the id of the project.
-
- + role: filters memberships based on the id of any role assigned to the membership.
-
- + status: filters memberships based on the status of the principal.
-
- + created_at: filters memberships based on the time the membership was created.
-
- + updated_at: filters memberships based on the time the membership was updated last.
- examples:
- name-filter:
- summary: Filtering on the name of the principal
- value: '[{ "name": { "operator": "=", "values": ["A User"] }" }]'
- global-memberships:
- summary: Get memberships for global roles
- value: '[{ "project": { "operator": "!*", "values": null }" }]'
- 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. Currently supported sorts are:
-
- + id: Sort by primary key
-
- + name: Sort by the name of the principal. Note that this depends on the setting for how the name is to be displayed at least for users.
-
- + email: Sort by the email address of the principal. Groups and principal users, which do not have an email, are sorted last.
-
- + status: Sort by the status of the principal. Groups and principal users, which do not have a status, are sorted together with the active users.
-
- + created_at: Sort by membership creation datetime
-
- + updated_at: Sort by the time the membership was updated last
- example: '[["id", "asc"]]'
- in: query
- name: sortBy
- required: false
- schema:
- default: '[["id", "asc"]]'
- type: string
+ - name: filters
+ in: query
+ required: false
+ schema:
+ type: string
+ 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:
+
+ + any_name_attribute: filters memberships based on the name of the principal. All possible name variants
+ (and also email and login) are searched.
+ + blocked: reduces the result set to all memberships that are temporarily blocked or that are not blocked
+ temporarily.
+ + group: filters memberships based on the name of a group. The group however is not the principal used for
+ filtering. Rather, the memberships of the group are used as the filter values.
+ + name: filters memberships based on the name of the principal. Note that only the name is used which depends
+ on a setting in the OpenProject instance.
+ + principal: filters memberships based on the id of the principal.
+ + project: filters memberships based on the id of the project.
+ + role: filters memberships based on the id of any role assigned to the membership.
+ + status: filters memberships based on the status of the principal.
+ + created_at: filters memberships based on the time the membership was created.
+ + updated_at: filters memberships based on the time the membership was updated last.
+ examples:
+ name-filter:
+ summary: Filtering on the name of the principal
+ value: '[{ "name": { "operator": "=", "values": ["A User"] }" }]'
+ global-memberships:
+ summary: Get memberships for global roles
+ value: '[{ "project": { "operator": "!*", "values": null }" }]'
+ - name: sortBy
+ in: query
+ required: false
+ schema:
+ default: '[["id", "asc"]]'
+ 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. Currently supported sorts are:
+
+ + id: Sort by primary key
+ + name: Sort by the name of the principal. Note that this depends on the setting for how the name is to be
+ displayed at least for users.
+ + email: Sort by the email address of the principal. Groups and principal users, which do not have an email,
+ are sorted last.
+ + status: Sort by the status of the principal. Groups and principal users, which do not have a status, are
+ sorted together with the active users.
+ + created_at: Sort by membership creation datetime
+ + updated_at: Sort by the time the membership was updated last
+ example: '[["id", "asc"]]'
responses:
'200':
+ description: OK
content:
application/hal+json:
+ schema:
+ $ref: '../components/schemas/membership_collection_model.yml'
examples:
- response:
- value:
- _embedded:
- elements:
- - _links:
- principal:
- href: "/api/v3/users/5"
- title: A user
- project:
- href: "/api/v3/projects/3"
- title: A Project
- roles:
- - href: "/api/v3/roles/4"
- title: Reader
- schema:
- href: "/api/v3/memberships/schema"
- self:
- href: "/api/v3/memberships/11"
- _type: Membership
- createdAt: '2015-03-20T12:56:56Z'
- id: 11
- updatedAt: '2018-12-20T18:16:11Z'
- - _links:
- principal:
- href: "/api/v3/groups/5"
- title: A group
- project:
- href: "/api/v3/projects/6"
- title: Another Project
- roles:
- - href: "/api/v3/roles/8"
- title: Project admin
- schema:
- href: "/api/v3/memberships/schema"
- self:
- href: "/api/v3/memberships/41"
- _type: Membership
- createdAt: '2019-12-22T12:56:06Z'
- id: 41
- updatedAt: '2020-12-20T18:16:12Z'
- _links:
- self:
- href: "/api/v3/memberships"
- _type: Collection
- count: 2
- total: 2
+ 'simple membership collection':
+ $ref: '../components/examples/membership-simple-collection-response.yml'
+ '400':
+ $ref: '../components/responses/invalid_query.yml'
+ '403':
+ description: Returned if the client is not logged in and login is required.
+ content:
+ application/hal+json:
schema:
- "$ref": "../components/schemas/list_memberships_model.yml"
- description: OK
- headers: {}
- tags:
- - Memberships
- description: Returns a collection of memberships. The client can choose to filter
- the memberships similar to how work packages are filtered. In addition to the
- provided filters, the server will reduce the result set to only contain memberships,
- for which the requesting client has sufficient permissions (*view_members*, *manage_members*).
- operationId: List_memberships
- summary: List memberships
+ $ref: '../components/schemas/error_response.yml'
+ example:
+ _type: Error
+ errorIdentifier: urn:openproject-org:api:v3:errors:MissingPermission
+ message: You are not authorized to view this resource.
+
post:
+ summary: Create a membership
+ operationId: create_membership
+ tags:
+ - Memberships
+ description: |-
+ Creates a new membership applying the attributes provided in the body.
+
+ You can use the form and schema to retrieve the valid attribute values and by that be guided towards successful
+ creation.
+
+ By providing a `notificationMessage` within the `_meta` block of the payload, the client can include a customized
+ message to the user of the newly created membership. In case of a group, the message will be sent to every user
+ belonging to the group.
+
+ By including `{ "sendNotifications": false }` within the `_meta` block of the payload, no notifications is send
+ out at all.
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '../components/schemas/membership_write_model.yml'
+ examples:
+ 'global role':
+ $ref: '../components/examples/membership-create-request-global-role.yml'
+ 'no notification':
+ $ref: '../components/examples/membership-create-request-no-notification.yml'
+ 'custom message':
+ $ref: '../components/examples/membership-create-request-custom-message.yml'
responses:
'201':
+ description: Created
content:
application/hal+json:
schema:
- "$ref": "../components/schemas/view_membership_model.yml"
- description: Created
- headers: {}
+ $ref: '../components/schemas/membership_read_model.yml'
+ examples:
+ 'simple membership':
+ $ref: '../components/examples/membership-simple-response.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:
@@ -149,40 +142,23 @@ post:
Returned if the client does not have sufficient permissions.
**Required permission:** Manage members
- headers: {}
'406':
- $ref: "../components/responses/missing_content_type.yml"
+ $ref: '../components/responses/missing_content_type.yml'
'415':
- $ref: "../components/responses/unsupported_media_type.yml"
+ $ref: '../components/responses/unsupported_media_type.yml'
'422':
content:
application/hal+json:
schema:
- $ref: "../components/schemas/error_response.yml"
- examples:
- response:
- value:
- _embedded:
- details:
- attribute: project
- _type: Error
- errorIdentifier: urn:openproject-org:api:v3:errors:PropertyConstraintViolation
- message: Project can't be blank.
+ $ref: '../components/schemas/error_response.yml'
+ example:
+ _embedded:
+ details:
+ attribute: project
+ _type: Error
+ errorIdentifier: urn:openproject-org:api:v3:errors:PropertyConstraintViolation
+ message: Project can't be blank.
description: |-
Returned if:
- * a constraint for a property was violated (`PropertyConstraintViolation`)
- headers: {}
- tags:
- - Memberships
- description: |-
- Creates a new membership applying the attributes provided in the body.
-
- You can use the form and schema to retrieve the valid attribute values and by that be guided towards successful creation.
-
- By providing a `notificationMessage` within the `_meta` block of the payload, the client can include a customized message to the user
- of the newly created membership. In case of a group, the message will be sent to every user belonging to the group.
-
- By including `{ "sendNotifications": false }` within the `_meta` block of the payload, no notifications is send out at all.
- operationId: Create_membership
- summary: Create membership
+ - a constraint for a property was violated (`PropertyConstraintViolation`)
diff --git a/docs/api/apiv3/paths/memberships_available_projects.yml b/docs/api/apiv3/paths/memberships_available_projects.yml
index 5eea9e42d3d..63b2a5bbf71 100644
--- a/docs/api/apiv3/paths/memberships_available_projects.yml
+++ b/docs/api/apiv3/paths/memberships_available_projects.yml
@@ -1,97 +1,30 @@
# /api/v3/memberships/available_projects
---
get:
+ summary: Available projects for memberships
+ operationId: memberships_available_projects
+ tags:
+ - Memberships
+ description: |-
+ Gets a list of projects in which a membership can be created in. The list contains all projects in which the user
+ issuing the request has the manage members permissions.
responses:
'200':
+ description: OK
content:
application/hal+json:
- examples:
- response:
- value:
- _embedded:
- elements:
- - _links:
- categories:
- href: "/api/v3/projects/6/categories"
- createWorkPackage:
- href: "/api/v3/projects/6/work_packages/form"
- method: post
- createWorkPackageImmediate:
- href: "/api/v3/projects/6/work_packages"
- method: post
- editWorkPackage:
- href: "/api/v3//work_packages/{id}/form"
- method: post
- templated: true
- memberships:
- href: "/api/v3/projects/6/memberships"
- self:
- href: "/api/v3/projects/6"
- title: A project
- _type: Project
- createdAt: '2015-07-06T13:28:14+00:00'
- description: Eveniet molestias omnis quis aut qui eum adipisci.
- Atque aut aut in exercitationem adipisci amet. Nisi asperiores
- quia ratione veritatis enim exercitationem magnam. Aut fuga
- architecto adipisci nihil. Et repellat pariatur. Aliquam et
- sed perferendis nostrum quaerat. Fugit doloremque voluptatem.
- id: 6
- identifier: a_project
- name: A project
- type: Customer Project
- updatedAt: '2015-10-01T09:55:02+00:00'
- - _links:
- categories:
- href: "/api/v3/projects/14/categories"
- createWorkPackage:
- href: "/api/v3/projects/14/work_packages/form"
- method: post
- createWorkPackageImmediate:
- href: "/api/v3/projects/14/work_packages"
- method: post
- memberships:
- href: "/api/v3/projects/14/memberships"
- self:
- href: "/api/v3/projects/14"
- title: Another project
- _type: Project
- createdAt: '2016-02-29T12:50:20+00:00'
- description: ''
- id: 14
- identifier: another_project
- name: Another project
- type:
- updatedAt: '2016-02-29T12:50:20+00:00'
- _links:
- self:
- href: "/api/v3/memberships/available_projects"
- _type: Collection
- count: 2
- total: 2
schema:
- "$ref": "../components/schemas/available_projects_for_memberships_model.yml"
- description: OK
- headers: {}
+ $ref: '../components/schemas/list_projects_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.
+ $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 members
- headers: {}
- tags:
- - Memberships
- description: Gets a list of projects in which a membership can be created in. The
- list contains all projects in which the user issuing the request has the manage
- members permissions.
- operationId: Available_projects_for_memberships
- summary: Available projects for memberships
diff --git a/docs/api/apiv3/paths/memberships_form.yml b/docs/api/apiv3/paths/memberships_form.yml
index 0fcf3b993c7..9bf9055eb21 100644
--- a/docs/api/apiv3/paths/memberships_form.yml
+++ b/docs/api/apiv3/paths/memberships_form.yml
@@ -1,34 +1,51 @@
# /api/v3/memberships/form
---
post:
+ summary: Form create membership
+ operationId: form_create_membership
+ tags:
+ - Memberships
+ description: |-
+ Requests and validates the creation form for memberships. The request payload, if sent, is validated. The form
+ endpoint itself does not create a membership.
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '../components/schemas/membership_write_model.yml'
+ examples:
+ 'global role':
+ $ref: '../components/examples/membership-create-request-global-role.yml'
+ 'no notification':
+ $ref: '../components/examples/membership-create-request-no-notification.yml'
+ 'custom message':
+ $ref: '../components/examples/membership-create-request-custom-message.yml'
responses:
'200':
description: OK
- headers: {}
+ content:
+ application/hal+json:
+ schema:
+ $ref: '../components/schemas/membership_form_model.yml'
+ examples:
+ form:
+ $ref: '../components/examples/membership-form-response.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"
- examples:
- response:
- value:
- _type: Error
- errorIdentifier: urn:openproject-org:api:v3:errors:MissingPermission
- message: You are not authorized to access this resource.
+ $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 memberships in any project
- headers: {}
'406':
- $ref: "../components/responses/missing_content_type.yml"
+ $ref: '../components/responses/missing_content_type.yml'
'415':
- $ref: "../components/responses/unsupported_media_type.yml"
- tags:
- - Memberships
- description: ''
- operationId: Membership_create_form
- summary: Membership create form
+ $ref: '../components/responses/unsupported_media_type.yml'
diff --git a/docs/api/apiv3/paths/memberships_schema.yml b/docs/api/apiv3/paths/memberships_schema.yml
index 1938956c65a..0e55775373e 100644
--- a/docs/api/apiv3/paths/memberships_schema.yml
+++ b/docs/api/apiv3/paths/memberships_schema.yml
@@ -1,77 +1,26 @@
# /api/v3/memberships/schema
---
get:
+ summary: Schema membership
+ operationId: get_membership_schema
+ tags:
+ - Memberships
+ description: Retrieves the schema for the membership resource object.
responses:
'200':
+ description: OK
content:
application/hal+json:
- examples:
- response:
- value:
- _dependencies: []
- _links:
- self:
- href: "/api/v3/memberships/schema"
- _type: Schema
- createdAt:
- hasDefault: false
- name: Created on
- required: true
- type: DateTime
- writable: false
- id:
- hasDefault: false
- name: ID
- required: true
- type: Integer
- writable: false
- notificationMessage:
- hasDefault: false
- location: _meta
- name: Message
- options: {}
- required: false
- type: Formattable
- writable: true
- principal:
- _links: {}
- hasDefault: false
- location: _links
- name: Principal
- required: true
- type: Principal
- writable: true
- project:
- _links: {}
- hasDefault: false
- location: _links
- name: Project
- required: false
- type: Project
- writable: true
- roles:
- _links: {}
- hasDefault: false
- location: _links
- name: Role
- required: true
- type: "[]Role"
- writable: true
- updatedAt:
- hasDefault: false
- name: Updated on
- required: true
- type: DateTime
- writable: false
schema:
- "$ref": "../components/schemas/view_membership_schema_model.yml"
- description: OK
- headers: {}
+ $ref: '../components/schemas/membership_schema_model.yml'
+ examples:
+ schema:
+ $ref: '../components/examples/membership-schema-response.yml'
'403':
content:
application/hal+json:
schema:
- $ref: "../components/schemas/error_response.yml"
+ $ref: '../components/schemas/error_response.yml'
examples:
response:
value:
@@ -82,9 +31,3 @@ get:
Returned if the client does not have sufficient permissions to see the schema.
**Required permission:** manage members or view memberships on any project
- headers: {}
- tags:
- - Memberships
- description: ''
- operationId: View_membership_schema
- summary: View membership schema