Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Update labels on issue using JIRA APIs

Colin Bowern September 9, 2015

I have tried both the REST API and SOAP API to update the labels.  On the REST API I tried to use a PUT /rest/api/latest/issue/XXX-1234 with the following body:

{ "update": { "labels": [ { "remove": "LabelX" }  ] } }

But it returns an HTTP 400:

{"errorMessages":[],"errors":{"labels":"Field 'labels' cannot be set. It is not on the appropriate screen, or unknown."}}

I understand that the error is telling me I need to put the labels on the screen itself, however doing so across all of the various projects would be quite time intensive.

On the SOAP API I tried to use PowerShell to do the same:

$Credential = Get-Credential -Message "JIRA Credentials"
$Proxy = New-WebServiceProxy -Uri http://xxxx/rpc/soap/jirasoapservice-v2?wsdl
$Token = $Proxy.login($Credential.GetNetworkCredential().UserName, $Credential.GetNetworkCredential().Password)
$RemoteFieldValues = @()
$RemoteFieldValue = new-object Microsoft.PowerShell.Commands.NewWebserviceProxy.AutogeneratedTypes.WebServiceProxy1c_soap_jirasoapservice_v2_wsdl.RemoteFieldValue
$RemoteFieldValue.id = "labels"
$RemoteFieldValue.values = @("LabelXY")
$RemoteFieldValues += $RemoteFieldValue
$Proxy.updateIssue($Token, "XXX-1234", $RemoteFieldValues)

But it returns the issue data set with an HTTP 200, but without the labels listed and no change to the underlying issue.

What methods have others used to update labels (add/remove) across many issues / projects?

1 answer

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Jobin Kuruvilla [Adaptavist]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 10, 2015

SOAP is not an option because it will be removed in JIRA7. For REST, you need to have the field on screen. Or you can create a REST plugin that exposes a new method, without the screen check.

I understand that the error is telling me I need to put the labels on the screen itself, however doing so across all of the various projects would be quite time intensive.

How many screens are we talking about? Surely you don't have a different screen for every single project?

TAGS
AUG Leaders

Atlassian Community Events