Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How can i get custom field value of particular issue using jira rest api?

Sneha Dobbey
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
July 30, 2018

When i access custom field value i'm getting integer value instead of String value.How can i get String value of custom field?

When i access following url i got the below response

Request url:

https://xxxxxxxxxxxxxxx.atlassian.net/rest/agile/1.0/issue/xxxx-2583?fields=customfield_10001

 

Response:

{
"expand": "renderedFields,names,schema,operations,editmeta,changelog,versionedRepresentations",
"id": "37163",
"self": "https://xxxxxxxxxxxx.atlassian.net/rest/agile/1.0/issue/37163",
"key": "xxxx-2583",
"fields": {
"customfield_10001": "6"
}
}

I want to get string value of custom field.

1 answer

0 votes
Mauricio Karas
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 3, 2018

Hi, Sneha.

From what it looks, based on the JSON response, the value of the custom field should already be a string because of the double quotes.

Can you tell how are you handling this response? Are you doing this within a script or program, if so, which programming language are you using?

Also, can you tell which type of field is your custom field, e.g. select list, text field, number field, etc? I would like to test this on my end.

Kind regards,
Maurício Karas

Sneha Dobbey
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 3, 2018

Hi Mauricio,

My Custom Field is Portfolio team. I am using accessing it via Jira api using Java programming language.

Thanks,

Sneha

Mauricio Karas
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 3, 2018

In this case, isn't it possible for you to cast the value from int to string after receiving the response from Jira?  I mean, within Java.

Are you getting any errors or unexpected behavior?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events