PUT json file into a field value

albertogarci86 June 25, 2018

Hi all,

 

I have a file with some value in a JSON format. (Obtained with an api rest curl GET from a text area custom field) 

{"expand":"renderedFields,names,schema,operations,editmeta,changelog,versionedRepresentations","id":"888051","self":"https://jira.com/rest/api/2/issue/888051","key":"KEY-0","fields":{"customfield_13630":"Date:: 2018-06-25 14:33:06 +0200 (Mon, 25 Jun 2018)
Author:: username
Message:: This is a json test"}}

 

Can I use any api rest method to post it into a custom field directly?

 

Thanks in advance!

Best Regards

1 answer

1 accepted

0 votes
Answer accepted
albertogarci86 June 25, 2018

Ok solved:

 

curl -k -D- -u "user:pass" -X PUT --data @file.json -H "Content-Type: application/json" JIRAURL

 

Regards

raj-kumar2 December 29, 2019

Hi Albert,

 

I have the same requirement, can you please share the complete steps you took to put the json response into Jira field?

Would appreciate your help on this.

Regards,

Raj

albertogarci86 January 7, 2020

Hello!

This is an example for editing a text field customfield_40494 in a BUG-569. First of all, I create the json file like this:

 

{"fields":{"customfield_40494":"EXAMPLE TEXT"}

After that I upload changes to the BUG-569 using the following command:

curl -k  -X PUT --data @jsonFile -H "Content-Type: application/json" "https://JIRAURL/rest/api/2/issue/BUG-569?fields=customfield_40494";

Suggest an answer

Log in or Sign up to answer