change the custom field value in JIRA JSON object to something meaningful

mUnit Developer February 23, 2018

Hi, I am working on a JIRA rest API, which would need the data of an issue, I have added custom fields to my project, but my JSON would not return the name of the custom fields, instead I get it with ID. Is there a way I can query it to return the name instead of custom field ID. 

 

using: GET : https://abc.xyz.com/rest/api/2/search?jql=project=xyz

and here is my part of response for 1 field

"issues": [
{

"expand": "operations,editmeta,changelog,transitions,renderedFields",
"id": "894189",
"self": "https://abc.xyz/rest/api/2/issue/894176",
"key": "xyz-6",
"fields": {
"customfield_12010": null,
"customfield_10351": null,
"fixVersions": [],
"customfield_10111": null,
"resolution": null,
"customfield_10112": null,
"customfield_10355": null,
"customfield_10225": null,
"customfield_12921": {
"self": "https://abc.xyz.com/rest/api/2/customFieldOption/12905",
"value": "abc",
"id": "12965"
},

]

In my project customfield_12921 is names as Type on front end. And I would like to use the fields with names instead of Id's as when I move this my prod instance the id changes and I would need to make the changes again.

Appreciate your help.

 

1 answer

0 votes
Alexey Matveev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 23, 2018

I think you would need to write a program. You could defince field ids programatically and construct your rest call. You can find more info about getting all fiedls with ids and names here:

https://developer.atlassian.com/cloud/jira/platform/rest/#api-api-2-field-get

Suggest an answer

Log in or Sign up to answer