Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Set label field via Jira-Python library or REST API

ABCD November 21, 2018

Hi,

I need to set the label field of few Jira tickets via jira-python binding
However so far I had no luck achieving this.

This is what I've tried so far.
==============================
As per the below link and few other forum posts, Ive tried to update the labels feils of few of the jira issues via Jira python library.
https://community.atlassian.com/t5/Jira-questions/How-to-update-labels-for-the-issues-present-in-Jql-query-Filter/qaq-p/265116

However I was constantly receiving the following errors

When using this method 

issue.update(labels=['SentToMaintainer'])

response text = {"errorMessages":["Can not instantiate value of type [simple type, class com.atlassian.jira.rest.api.issue.FieldOperation] from JSON String; no single-String constructor/factory method (through reference chain: com.atlassian.jira.rest.v2.issue.IssueUpdateBean[\"update\"])"]}
When using the second method 
----------------------------
issue.update(fields={"labels": ['SentToMaintainer']})

response text = {"errorMessages":[],"errors":{"labels":"Field 'labels' cannot be set. It is not on the appropriate screen, or unknown."}}
I also tried to directly changing the field with no luck (no error but it doesnt show up correctly in the webpage)
issue.fields.labels = ['sentomaintainer']
>>> issue.fields.labels
['sentomaintainer']

https://community.atlassian.com/t5/Jira-questions/Problem-trying-to-add-label-using-cURL/qaq-p/255420

As per this issue, I checked my credentials and when done manually I can change the label field. so that should not be the case

Any help is much appreciated

Thanks
ABCD

1 answer

0 votes
tomd
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 26, 2018

Hello,

What Jira version are you using?

Tom

ABCD December 12, 2018

Hi Tomasz 

 

Thanks much for the reply. The version im using is v6.4.14#64029-sha1:ae256fe.

I understand this error is logical given that the  CF im trying to stipulate is actually in another screen. But is there a way to switch to a different screen through REST ? 

For example if i do it manually Id click Resolve -> (new popup window comes) then select the label value there and push to to resolved .

So the actual question is how do i do that through REST if its possible

Thanks heaps and apologies for the late reply as I was travelling during this period

 

Cheeers

ABCD

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events