Change an ownership (tenant:forge:write and maintainer, or tenant:forge:admin)
PATCH /api/forge/v1/projects/{key}/ownerships/{id}
Module: Forge · operationId: patchForgeOwnership · Tag: Configuration · Auth: access token (Authorization: Bearer <accessToken>)
Same permission as creating. version is required (409 version_conflict); the key never changes. A new name becomes the description of the ownership's label. An empty ownerRef, ownerTeamId or parentId clears it; setting the person clears the team and the other way round.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
key |
path | string | yes | Project key (e.g. APP) |
id |
path | string (uuid) | yes |
Request body
application/json (required)
deputyRefs(array of string): E-mails of the deputiesdescription(string): Description (max length 2000)itemTypes(array of string): Item type keyskey(string): Create: key; fixed afterwardsmatchLabelIds(array of string (uuid)): Plain labels (neverowner::…)name(string): Display name (max length 80)ownerRef(string): E-mail of the owner person; empty clears it on PATCHownerTeamId(string): Owning team; empty clears it on PATCHparentId(string): Parent ownership; empty clears it on PATCHpaths(array of string): Repository path patterns (see Ownership.paths)version(integer): PATCH: the version the change is based on
Example:
{
"paths": [
"app/android/**",
"app/shared/push/**"
],
"version": 1
}
Responses
- 200 Changed (
application/json) - 400 Error (
application/json) - 403 Error (
application/json) - 404 Error (
application/json) - 409 Error (
application/json)
Fields of the 200 answer:
deputyRefs(array of string, required): E-mails of the deputies (members, at least developer); need an owner of their owndescription(string, required): Description (max length 2000)id(string (uuid), required): Ownership iditemTypes(array of string, required): Item type keys: items of these types belong here (without an owner:: label)key(string, required): Key; never changes (its label isowner::<key>)labelId(string (uuid), required): The ownership's labelowner::<key>; items carry it and it wins over the matchersmatchLabelIds(array of string (uuid), required): Plain labels (neverowner::…): items carrying one belong here (without an owner:: label); the later position winsname(string, required): Display name (max length 80)ownerRef(string, nullable, required): E-mail of the owner person (a member, at least developer); exclusive with ownerTeamIdownerTeamId(string (uuid), nullable, required): The owning team; exclusive with ownerRef. Neither is allowed only with a parent (inherited)parentId(string (uuid), nullable, required): The parent ownership (same project, no cycle, at most 4 levels); without an owner of its own the nearest ancestor's appliespaths(array of string, required): Repository path patterns, the CODEOWNERS subset: segments separated by/,*and?within a segment,**as a whole segment for any number of directories. A pattern without/(other than a trailing one) matches at any depth, one with/is relative to the root (a leading/anchors explicitly); a trailing/matches directories. A pattern whose last segment has no wildcard also matches everything below the directory it names (hr,/apps/github); one ending in a wildcard matches only what it names (docs/*). No character classes,\,!,#or spaces. Paths decide only for code (CODEOWNERS, scm).position(integer, required): Precedence: a later ownership wins a path or an item both matchversion(integer, required): Optimistic-locking version; send it with PATCH
Example 200 answer:
{
"deputyRefs": [
"paul.schmid@muster-it.example"
],
"description": "Kotlin-Code der Android-App.",
"id": "df9a0b1c-2d3e-4f4a-9b12-9d0e1f2a3b02",
"itemTypes": [],
"key": "android",
"labelId": "8a4b5c6d-7e8f-4a9b-8cad-4e5f6a7b8c06",
"matchLabelIds": [],
"name": "Android-App",
"ownerRef": "marie.wagner@muster-it.example",
"ownerTeamId": null,
"parentId": "df9a0b1c-2d3e-4f4a-9b12-9d0e1f2a3b01",
"paths": [
"app/android/**"
],
"position": 3,
"version": 1
}
Example request
curl -X PATCH 'https://api.mbcom.cloud/api/forge/v1/projects/string/ownerships/3f2b8c1e-7d4a-4e9b-9c2a-5b1d6e8f0a12' \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H 'Content-Type: application/json' \
--data '{"paths":["app/android/**","app/shared/push/**"],"version":1}'