Jira Cloud fields and work types
Jira multi group picker custom field: set via API
The multiple groups picker takes an array of {"name": ...} objects and returns an array with name, groupId and self per group. Edit metadata allows add, set and remove.
Endpoints
| Method | Path | What it does |
|---|---|---|
PUT | /rest/api/3/issue/{issueIdOrKey} | Sets or changes the value. |
GET | /rest/api/3/issue/{issueIdOrKey} | Reads the stored value. |
GET | /rest/api/3/issue/{issueIdOrKey}/editmeta | Lists what can be edited. |
Examples
PUT /rest/api/3/issue/{issueIdOrKey}
Sets a list with one group.
curl
curl -X PUT \
-u "you@example.com:$ATLASSIAN_API_TOKEN" \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
--data '{
"fields": {
"customfield_10176": [
{
"name": "org-admins"
}
]
}
}' \
'https://your-domain.atlassian.net/rest/api/3/issue/{issueIdOrKey}?returnIssue=true&fields=customfield_10176'Python (requests)
import os
import requests
EMAIL = "you@example.com"
r = requests.put(
'https://your-domain.atlassian.net/rest/api/3/issue/{issueIdOrKey}?returnIssue=true&fields=customfield_10176',
auth=(EMAIL, os.environ["ATLASSIAN_API_TOKEN"]),
headers={'Accept': 'application/json'},
params={'returnIssue': 'true', 'fields': 'customfield_10176'},
json={'fields': {'customfield_10176': [{'name': 'org-admins'}]}},
)
print(r.status_code, r.text)Response: HTTP 200
{
"key": "ZZREF-6",
"fields": {
"customfield_10176": [
{
"name": "org-admins",
"groupId": "d1f51bd8-b8a8-48b9-a94a-1c84393fba7a",
"self": "https://your-domain.atlassian.net/rest/api/3/group?groupId=d1f51bd8-b8a8-48b9-a94a-1c84393fba7a"
}
]
}
}Sent to Atlassian Cloud on .
PUT /rest/api/3/issue/{issueIdOrKey}
The same write on another work item gives the same array of group objects.
curl
curl -X PUT \
-u "you@example.com:$ATLASSIAN_API_TOKEN" \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
--data '{
"fields": {
"customfield_10196": [
{
"name": "org-admins"
}
]
}
}' \
'https://your-domain.atlassian.net/rest/api/3/issue/{issueIdOrKey}?returnIssue=true&fields=customfield_10196'Python (requests)
import os
import requests
EMAIL = "you@example.com"
r = requests.put(
'https://your-domain.atlassian.net/rest/api/3/issue/{issueIdOrKey}?returnIssue=true&fields=customfield_10196',
auth=(EMAIL, os.environ["ATLASSIAN_API_TOKEN"]),
headers={'Accept': 'application/json'},
params={'returnIssue': 'true', 'fields': 'customfield_10196'},
json={'fields': {'customfield_10196': [{'name': 'org-admins'}]}},
)
print(r.status_code, r.text)Response: HTTP 200
{
"key": "ZZREF-11",
"fields": {
"customfield_10196": [
{
"name": "org-admins",
"groupId": "d1f51bd8-b8a8-48b9-a94a-1c84393fba7a",
"self": "https://your-domain.atlassian.net/rest/api/3/group?groupId=d1f51bd8-b8a8-48b9-a94a-1c84393fba7a"
}
]
}
}Sent to Atlassian Cloud on .
GET /rest/api/3/issue/{issueIdOrKey}
Reading returns the array with the group.
curl
curl -G \
-u "you@example.com:$ATLASSIAN_API_TOKEN" \
-H 'Accept: application/json' \
--data-urlencode 'fields=customfield_10162,customfield_10163,customfield_10164,customfield_10165,customfield_10166,customfield_10167,customfield_10168,customfield_10169,customfield_10170,customfield_10171,customfield_10172,customfield_10173,customfield_10174,customfield_10175,customfield_10176,customfield_10177,customfield_10178,customfield_10179,customfield_10180,customfield_10181' \
'https://your-domain.atlassian.net/rest/api/3/issue/{issueIdOrKey}'Python (requests)
import os
import requests
EMAIL = "you@example.com"
r = requests.get(
'https://your-domain.atlassian.net/rest/api/3/issue/{issueIdOrKey}',
auth=(EMAIL, os.environ["ATLASSIAN_API_TOKEN"]),
headers={'Accept': 'application/json'},
params={'fields': 'customfield_10162,customfield_10163,customfield_10164,customfield_10165,customfield_10166,customfield_10167,customfield_10168,customfield_10169,customfield_10170,customfield_10171,customfield_10172,customfield_10173,customfield_10174,customfield_10175,customfield_10176,customfield_10177,customfield_10178,customfield_10179,customfield_10180,customfield_10181'},
)
print(r.status_code, r.text)Response: HTTP 200
{
"key": "ZZREF-6",
"fields": {
"customfield_10176": [
{
"name": "org-admins",
"groupId": "d1f51bd8-b8a8-48b9-a94a-1c84393fba7a",
"self": "https://your-domain.atlassian.net/rest/api/3/group?groupId=d1f51bd8-b8a8-48b9-a94a-1c84393fba7a"
}
]
}
}Sent to Atlassian Cloud on .
GET /rest/api/3/issue/{issueIdOrKey}/editmeta
Edit metadata lists add, set and remove.
curl
curl \
-u "you@example.com:$ATLASSIAN_API_TOKEN" \
-H 'Accept: application/json' \
'https://your-domain.atlassian.net/rest/api/3/issue/{issueIdOrKey}/editmeta'Python (requests)
import os
import requests
EMAIL = "you@example.com"
r = requests.get(
'https://your-domain.atlassian.net/rest/api/3/issue/{issueIdOrKey}/editmeta',
auth=(EMAIL, os.environ["ATLASSIAN_API_TOKEN"]),
headers={'Accept': 'application/json'},
)
print(r.status_code, r.text)Response: HTTP 200
{
"fields": {
"customfield_10176": {
"name": "zz-ref multigroup",
"operations": [
"add",
"set",
"remove"
]
}
}
}Sent to Atlassian Cloud on .
How it behaves
- Type key com.atlassian.jira.plugin.system.customfieldtypes:multigrouppicker, searcher key com.atlassian.jira.plugin.system.customfieldtypes:grouppickersearcher, schema type array with items group, display name "Group Picker (multiple groups)".
- [{"name": "org-admins"}] answered 200 and the field read back as an array with one group object.
- Edit metadata lists operations add, set and remove for the field.
Pitfalls
- A missing group name gives a 400 on the single group field; the multiple groups field was not probed with a missing name or a single object.
- A fields write replaces every group already stored.
- The searcher is shared with the single group picker.
Questions and answers
Can several groups be stored?
Yes, the field is an array and the run stored a list with one group object.
Related
- Group picker (single group)
- User picker (multiple users)
- Select list (multiple choices)
- Reading field values: names, schema, v2 and v3
- Which fields can be set: editmeta and createmeta