Forums

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

JIRA REST API calls failing with "Operation value must be a string" for customField update

Daave March 21, 2018

I've seen this problem posted many times, with no clear answer. I'm doing something really simple - updating a text field.


`curl -vvv -D- -u  myuser:mypass -X PUT -d '@data.txt' -H "Content-Type: application/json" http://myJIRAinstance/rest/api/2/issue/ProjectNumer-100`

My data.txt looks like this:

{
    "fields" : {
        "customfield_15801" :
        {"value" : "Test"}
    }
}

 

`"name":"Row Name","operations":["set"]},"customfield_15801":{"required":false,"schema":{"type":"string","custom":"com.atlassian.jira.plugin.system.customfieldtypes:textarea","customId":15801},`

I have tried changing all sorts of things - single quotes to double, sending as a string and not JSON (no error results from that, but the Issue is not updated either), tried sending the data not in a file - all sorts of things. This custom field does have "Set" allowed. I've followed the documentation exactly.

There are a handful of other things I'm trying to do, very simple things. Attach a text file to an Issue. Get the list of all Issues in a Project. Everything is failing, so I'm wondering if there's some bigger issue??

JIRA version is 7.8

 

2 answers

4 votes
Daave March 22, 2018

The docs are wrong. This is the format that worked for a simple text-based field:

 

curl -D- -u  user:'pass' -X PUT -d '@data.txt' -H "Content-Type: application/json" http://jiraServer:8080/rest/api/2/issue/ISSUE-100

cat data.txt
{
    "fields" : {
        "customfield_15801": "TEST"
    }
}

Lars-Harald Båtnes January 16, 2024

this is true for jira automations as well, using "edit issue" action and "Additional fields"

0 votes
Daave March 22, 2018

Also if you're trying to DELETE files, you have to get the ID first. Here is a one-liner I made to get the IDs for an issue

 

curl -s -u  user:'pass' -X GET -H "X-Atlassian-Token: no-check" http://jiraServer:8080/rest/api/2/issue/ISSUE-100?fields=attachment | egrep -o "attachment/*[0-9]*" | sort -u | sed '1d' | sed s'&attachment/&&'

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events