PATCH customfield via REST

Mark Northcott
Contributor
September 11, 2022

Hello all,

I am trying to run a REST API PATCH to update a Jira Align customfield with a new dropdown value, and I am having problems finding the correct format.

The GET returns the following

"customFields": [

    {

      "customfield_90704": [

        {

          "id": 198,

          "value": " High"

        }

      ]

    }

]

However, finding the correct JSON Patch is hard. I've tried lots including the following but nothing seems to work. I think the path is close but then it says the values are not valid. Is this the correct format for  nested values deriving their values from a dropdown?

[{

"op": "replace",

"path": "/customfields/custom-field_90704/",

"value": {"id": "197", "value": "Very High"}

}]

[{

"op": "replace",

"path": "/customfields/0/customfield_90704/",

"value": {"id": 197,"value":"Very High"}

}]

[{

"op": "replace",

"path": "/customfields/:customfield_90704/",

"value": {"id": 197,"value": "Very High"}

}]

Any help would be appreciated.

1 answer

1 accepted

3 votes
Answer accepted
Enio Marques Junior
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 12, 2022

Hi Mark! Please try using the payload below:

[
{
"op": "replace",
"path": "/customFields/0/customfield_90704/0/value",
"value": "Very High"
},
{
"op": "replace",
"path": "/customFields/0/customfield_90704/0/id",
"value": 197
}
]

 

Regards,

Enio

Mark Northcott
Contributor
September 16, 2022

Thank you Enio, your solution worked perfectly.

I did get another solution from Atlassain but it came up with an error "Not all custom field are active"

[
  {
        "op": "replace",
        "path": "customfields/0",
        "value":
        {
            "customfield_90706":
            [
                {
                   "id": 183,
                    "value": "Very High"
                }
            ]
        }
    }
]

 

I thought it might be that the field was not active in that story but that was nto the problem ... but who cares, your solution worked :-) 

Thanks again

Heidi Hendry
Contributor
May 20, 2024

Came here looking for similar information on using API to fill the Epic Benefits tab "Case Development" fields.
The above wasn't quite working for me

Found this resource:
How to use PATCH on the Feature/Epic custom fields in the API v2 in Jira Align | Jira Align | Atlassian Documentation

 

It is important when you have lots of Custom fields, to run the editmeta to find out where in the Custom Fields array your particular custom fields are.

Hope this helps anyone else hunting for similar info.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events