I am having trouble adding a component to a label type in Jira.
import browser_cookie3
import requests
import json
cj = browser_cookie3.load()
url = ""
text = {'fields': {'customfield_xxxx':['test']}}
r = requests.put(url, json=text, cookies=cj)
print(r.status_code)
With the above code, I can update the label list. However, I need to achieve the following - The label contains[ ABC, 123 ] and I want to add component [ZXC] to the existing list. My goal is to have[ABC, 123, ZXC] but with the above shown code it updates to - [ZXC]
I did find that in editmeta there is "add" function for the customfield, however, I was unable to make it work.
Thank you in advance!
Hi @TooManyFormChecks ,
The JSON you need to use is as follows:
{
"update": {
"labels": [{
"add": "test_2"
}]
}
}
This will add the label "test_2" but not overwrite the whole field.
Thank you so much! I was so close as well! I had fields but I needed to place update! Also, it could be that I tried this and was not working because I was using /rest/api/2/issue/ISSUEKEY/editmeta but I did not need to append it with editmeta. Once again, thank you very much !
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.