Hello, I’ve encountered a problem when calling PUT /rest/api/2/issue.
Jira Cloud responds with 500 and
{
"errorMessages": [
"We couldn't save your changes. Copy your content, then try reloading the page."
],
"errors": {}
}
The field that I want to edit is an ace app Issue Field with type “rich_text”
What am I doing wrong?
Thanks in advance.
@Tronikel welcome to the Atlassian developer community,
You have to dereference the field name
to a field id
. You can do that with GET /rest/api/2/field/search
to Get fields paginated. For example, if I use query=Text%20Area
, then I get:
{
"maxResults": 50,
"startAt": 0,
"total": 1,
"isLast": true,
"values": [
{
"id": "customfield_10437",
"name": "Text Area 1619794712753",
"schema": {
"type": "string",
"custom": "com.atlassian.jira.plugin.system.customfieldtypes:textarea",
"customId": 10437
},
"description": "Custom field for document-like content 2021-04-30T14:58:32.753Z"
}
]
}
Now, I can make the request like so:
{
"fields": {
"customfield_10437": "can set"
}
}
Thanks for the answer, but I already tried that and got the same result.
Let me give more context to this error.
So, I am building an ace app, it’s not my first one, which has a connect module → Issue Field
This field gets assigned/updated to a Jira Issue through my app, the request is shown below.
Now is the interesting part:
When I call the PUT request for the first time (on an issue which does not have my field assigned) it updates correctly.
But when I change the value and call PUT a second time (the issue already had my field assigned) the error pops up.
And, also, when I call PUT with the same values as the first PUT, it works.
e.g.
- I create an Issue
- Call PUT, value get saved correctly
- Add a random letter to my current value at the end and call PUT, get error
- Remove my random letter at the end and call PUT, then it works
So my guess is that my field is like a read-only field which you can only set once
BUT, everything works if I change my Issue Field type from “rich_text” to “text”. Sadly, I can’t do that because the 255 character limit is too small for my needs because I’m storing stringified JSON in it.
Thanks in advance for your time & help!
1 Like
@Tronikel,
Thanks for the full context! Issue field module does change the field reference behavior. It sure is interesting that this is specific to rich_text
but I don’t have any insights. I hope we can get a Jira Cloud & Connect expert to weigh in.
@ibuchanan,
Thank you very much for the quick replies!
Quick update:
Next day I tried to update the fields again, and the problem seems to be fixed now!
1 Like
Edit: A Couple of days later, the error appeared again, have no idea why is this happening
@Tronikel
Did you resolve the issue?
Could you please post the body JSON you’re using in this case? There’s a slight difference between using update
and fields
(and not both).
Have you tried same thing with api/3/issue
(instead of api/2/issue
)?
Hi @ViliusZigmantas.
Yeah, the issue is long gone by now, probably something was wrong with jira servers