Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Unable to retrieve context field options

Hi Team

I am trying to retrieve the custom field options using the https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-custom-field-options/#api-rest-api-3-customfield-fieldid-context-contextid-option-get i tried passing both custom field id and context id. I retrieved the context id using the https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-fields/#api-rest-api-3-field-fieldid-contexts-get. custom field options gives 404 error can some one please help me in retrieving the custom field options based on context

1 answer

1 accepted

0 votes
Answer accepted

Hello @Yellalingh Margonda ,

Thanks for reaching out and looking at this one it is a little confusing as the value formats for "fieldid" in the calls of the "field" endpoint compared to the call for the "customfield" endpoint are different and a little counterintuitive.

For obtaining the context id noted in the endpoint "GET /rest/api/3/field/{fieldId}/contexts"   you need to input the "fieldid" variable in the format "customfield_id" to differentiate between a system field (id only) vs custom fields (custom field + id)

An example of a custom field with ID = 10273 in my test instance would be as follows:

GET /rest/api/3/field/customfield_10273/contexts

the results come back as follows noting the context is "10420":

{
"maxResults": 20,
"startAt": 0,
"total": 1,
"isLast": true,
"values": [
{
"id": 10420,
"name": "Default Configuration Scheme for AAA_TEST_ elect List (single choice)",
"description": "Default configuration scheme generated by Jira",
"associatedIssueTypes": [
{
"self": "https://<BASE_URL>.atlassian.net/rest/api/3/issuetype/10108",
"id": "10108",
"description": "Track underlying causes of incidents. Created by Jira Service Desk.",
"iconUrl": "https://<BASE_URL>.atlassian.net/secure/viewavatar?size=medium&avatarId=10604&avatarType=issuetype",
"name": "Problem",
"subtask": false,
"avatarId": 10604
}
],
"associatedProjects": [],
"isAllProjects": true,
"isAllIssueTypes": false
}
]
}

Then in the secondary call "GET /rest/api/3/customField/{fieldId}/context/{contextId}/option"  as you are already doing a call against the custom field endpoint so there are not any standard fields as valid inputs so  the format for "fieldid" is going to only be formatted as the number as follows:

GET /rest/api/3/customField/10273/context/10420/option

And in my example would return as follows:

{
"maxResults": 100,
"startAt": 0,
"total": 8,
"isLast": true,
"values": [
{
"id": "10529",
"value": "1",
"disabled": false
},
{
"id": "10530",
"value": "2",
"disabled": false
},
{
"id": "10531",
"value": "3",
"disabled": false
},
{
"id": "10532",
"value": "4",
"disabled": false
},
{
"id": "10533",
"value": "5",
"disabled": false
},
{
"id": "10534",
"value": "6",
"disabled": false
},
{
"id": "10535",
"value": "7",
"disabled": false
},
{
"id": "10536",
"value": "8",
"disabled": false
}
]
}

Hope this helps, and let me know if you have any additional questions.

Regards,
Earl

I dont see that api available for Jira Server. Is there a way to do it in Server?


Hi Allen I currently need support on CA-1278615. 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
Community showcase
Published in Apps & Integrations

Send an Email or Publish to Confluence - What should you do with your release notes?

Background When you hear the words ‘Release notes’, almost always you think of an unsolicited email from a software vendor. But I am here to tell you that from our data, sending release notes via E...

98 views 1 1
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you