I am getting an error when making an api call to update the priority of an issue using a script listener. Could someone tell me how I can resolve these errors?
Here is my api call:
put("/rest/api/2/issue/${issue.key}")
.header("Content-Type", "application/json")
.body(
fields: {
priority: {id:"1"}
}
)
.asString()
Here is the error response:
body: {"errorMessages":[],"errors":{"delegate":"Field 'delegate' cannot be set. It is not on the appropriate screen, or unknown.","owner":"Field 'owner' cannot be set. It is not on the appropriate screen, or unknown.","maximumNumberOfParameters":"Field 'maximumNumberOfParameters' cannot be set. It is not on the appropriate screen, or unknown.","parameterTypes":"Field 'parameterTypes' cannot be set. It is not on the appropriate screen, or unknown.","resolveStrategy":"Field 'resolveStrategy' cannot be set. It is not on the appropriate screen, or unknown.","thisObject":"Field 'thisObject' cannot be set. It is not on the appropriate screen, or unknown.","directive":"Field 'directive' cannot be set. It is not on the appropriate screen, or unknown."}}
I have resolved the api errors by substituting curly brackets in the request body for square brackets. The docs for the request body suggest curly brackets but it seems only square brackets work. I hope this helps someone else.
put("/rest/api/2/issue/${issue.key}")
.header("Content-Type", "application/json")
.body([
fields: [
priority: [ name: NewPriority ]
]
])
.asString()
Thank you! This is the only result when you Google the issue, but fortunately it works.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.