Jira Cloud fields and work types
Jira group picker custom field: set by name via API
The group picker is written with {"name": group name} and read back as an object with name, groupId and self. The response identifies the group by a stable groupId.
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 the field to a group by name.
curl
curl -X PUT \
-u "you@example.com:$ATLASSIAN_API_TOKEN" \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
--data '{
"fields": {
"customfield_10175": {
"name": "org-admins"
}
}
}' \
'https://your-domain.atlassian.net/rest/api/3/issue/{issueIdOrKey}?returnIssue=true&fields=customfield_10175'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_10175',
auth=(EMAIL, os.environ["ATLASSIAN_API_TOKEN"]),
headers={'Accept': 'application/json'},
params={'returnIssue': 'true', 'fields': 'customfield_10175'},
json={'fields': {'customfield_10175': {'name': 'org-admins'}}},
)
print(r.status_code, r.text)Response: HTTP 200
{
"key": "ZZREF-6",
"fields": {
"customfield_10175": {
"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}
A group name that does not exist is refused.
curl
curl -X PUT \
-u "you@example.com:$ATLASSIAN_API_TOKEN" \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
--data '{
"fields": {
"customfield_10195": {
"name": "no-such-group"
}
}
}' \
'https://your-domain.atlassian.net/rest/api/3/issue/{issueIdOrKey}?returnIssue=true&fields=customfield_10195'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_10195',
auth=(EMAIL, os.environ["ATLASSIAN_API_TOKEN"]),
headers={'Accept': 'application/json'},
params={'returnIssue': 'true', 'fields': 'customfield_10195'},
json={'fields': {'customfield_10195': {'name': 'no-such-group'}}},
)
print(r.status_code, r.text)Response: HTTP 400
{
"errorMessages": [],
"errors": {
"customfield_10195": "Could not find group with name 'no-such-group'"
}
}Sent to Atlassian Cloud on .
POST /rest/api/3/search/jql
Finds work items by group name with =.
curl
curl -X POST \
-u "you@example.com:$ATLASSIAN_API_TOKEN" \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
--data '{
"jql": "project = ZZREF AND \"zz-ref group\" = org-admins",
"fields": [
"summary"
],
"maxResults": 2
}' \
'https://your-domain.atlassian.net/rest/api/3/search/jql'Python (requests)
import os
import requests
EMAIL = "you@example.com"
r = requests.post(
'https://your-domain.atlassian.net/rest/api/3/search/jql',
auth=(EMAIL, os.environ["ATLASSIAN_API_TOKEN"]),
headers={'Accept': 'application/json'},
json={'jql': 'project = ZZREF AND "zz-ref group" = org-admins',
'fields': ['summary'],
'maxResults': 2},
)
print(r.status_code, r.text)Response: HTTP 200
{
"issues": [
{
"key": "ZZREF-11"
}
],
"isLast": true
}Sent to Atlassian Cloud on .
GET /rest/api/3/issue/{issueIdOrKey}
Reading returns the same group object.
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_10175": {
"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 gives the operation set.
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_10175": {
"name": "zz-ref group",
"operations": [
"set"
]
}
}
}Sent to Atlassian Cloud on .
How it behaves
- Type key com.atlassian.jira.plugin.system.customfieldtypes:grouppicker, searcher key com.atlassian.jira.plugin.system.customfieldtypes:grouppickersearcher, schema type group, display name "Group Picker (single group)".
- {"name": "org-admins"} answered 200 and the response is {"name": ..., "groupId": ..., "self": ...}.
- {"name": "no-such-group"} gave 400 "Could not find group with name 'no-such-group'".
- "zz-ref group" = org-admins matched the work item holding that group; edit metadata shows only the set operation.
Pitfalls
- Only a name given by exact text was probed; the response for an unknown group name was not tested.
- The request used the group name; the response also gives a groupId.
- The error for a missing group repeats the name that was sent, which helps spot a typo.
Questions and answers
Is the group set by name or by id?
By name in the run: {"name": "org-admins"}. The response added a groupId.
Related
- Group picker (multiple groups)
- User picker (single user)
- User picker (multiple users)
- Reading field values: names, schema, v2 and v3
- Which fields can be set: editmeta and createmeta