I’m trying the change the priority of an issue via the API but somehow it is not letting me.
The credentials/connection works as I can change other fields. I’m sending a PUT request to https://.atlassian.net/rest/api/3/priority/10100 with the following content:
{
"uri": "https://.atlassian.net/rest/api/3/priority/10088",
"method": "PUT",
"authentication": {
"username": "*sanitized*",
"password": "*sanitized*",
"type": "Basic"
},
"body": {
"fields": {
"priority": {
"name": "High"
}
}
}
}
I have a priority in Jira that equals “High”. It is printing the following output:
{
"errorMessages": [
"The request body parameters are missing."
],
"errors": {}
}
It’s probably something trivial but I havent found the problem yet, anybody that could point me in the right direction?
Hello @SentinelAutomation
If you refer to the Update Priority endpoint documentation, you’ll see examples that show the correct format of the request body and the parameters it can contain.
Welcome to the Atlassian Developer Community, @SentinelAutomation!
I need to clarify your use case:
- Do you want to edit the issue priority i.e. the priority description, name, or icon URL? If so,
PUT /rest/api/3/priority/{id}
is the correct endpoint but you need to use the correct body parameters as it does not accept the fields
parameter. For example, if you want to change the name of the issue priority with ID 10088
to High
then the body should be (this means you’ll have two issue priorities with the name High
though, is this what you want?)
"body": {
"name": "High"
}
- Do you want to update an issue’s priority? Based on the body parameter you used in the code snippet, this looks to be the one that you want to achieve. If so, use the Edit issue REST API. Using the example you provided, you can try something like,
{
"uri": "https://myinstance.atlassian.net/rest/api/3/issue/{issueIdOrKey}",
"method": "PUT",
"authentication": {
"username": "*sanitized*",
"password": "*sanitized*",
"type": "Basic"
},
"body": {
"fields": {
"priority": {
"name": "High"
}
}
}
}
Cheers,
Ian
Hi Ian,
Thanks for your reply. Yes I’m looking to change the priority of an issue, so option 2.
I used exactly the same code as you suggested but I’m still getting the same error as I wrote in the starting message of this post.
{
"errorMessages": [
"The request body parameters are missing."
],
"errors": {}
}
Hello @SentinelAutomation and @iragudo
To change an issue’s priority via the Priority field, you can also refer to the id of the priority value:
"body": {
"fields": {
"priority": {
"id": "2"
}
}
}
Hi @sunnyape,
I’ve tried to use the ID field instead of the name field but that produces the same error.
Are you able to reproduce the error that I’m having? Or is the syntax as provided by Ian working for you guys?
I cannot reproduce that error @SentinelAutomation
I did a PUT request to the Update Issue endpoint using Postman and used the priority name method, as per Ian’s example:
A 204 response of ‘1’ means it worked as expected, without error.
I then checked that issue via a GET request to the Get Issue endpoint and it confirmed the priority had been changed to ‘Low’:
1 Like