Forums

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

Reference a custom fields value in API call

Brandon Kreiens March 18, 2019

Hello,

 

I'm looking to connect our CRM to our JIRA instance via API. Essentially that I'm trying to do is let agents in our CRM connect a ticket from a customer to a ticket in JIRA and then track how many such tickets in our CRM have been connected to a single JIRA ticket.

But, (and I'm not sure if it's possible), I can't seem to find the right way to format the json.

 

What I'm trying is:

PUT: https://OURURL/rest/api/2/issue/TST-1/

with this json:

{
"fields": {
"custom_field_11400" : {{issue.customfield_11400}}+1
}
}

 

What I need to figure out is what is the proper way to reference the custom field itself in the json so that I can add 1 to that value when the agents want to connect in a new ticket.

 

Thanks!
Brandon

 

1 answer

1 accepted

0 votes
Answer accepted
Andy Heinzer
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 20, 2019

You can't do this in a single REST API call to Jira.  You would have to first do a GET call to that same endpoint, GET /rest/api/2/issue/{issueIdOrKey} and then lookup the value of that specific custom field.

Only after you do this, could you then use a second call to PUT /rest/api/2/issue/{issueIdOrKey} and then pass this the updated value in order to change the field value.   I can't think of anyway that you could only make one call and both find out the value and update it.

Brandon Kreiens March 21, 2019

Darn! OK well thanks for the assist!

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events