Removing component from issue via REST API

Hello,

according to documentation, I tried to remove component from an issue.

This is my request body:

{
    "update":{
        "components":[
            {
                "remove": [{"name": "Network"}]
            }
        ]
    }
}

but I’m receiving 400 error with following error message:

“components”: “Can not deserialize instance of com.atlassian.jira.issue.fields.rest.json.beans.ComponentJsonBean out of START_ARRAY token\n at [Source: N/A; line: -1, column: -1]”

What I doing wrong?

@PaweJakimiak,

I tried all the update verbs that I could find using Jira Server API docs, in the hopes the functionality hasn’t changed. Here’s what I found:

add

Fails for both name and id with status 400 and this response:

{
  "errorMessages": [],
  "errors": {
    "components": "Could not find valid 'id' or 'name' in component object."
  }
}

remove

Fails for both name and id with status 400 and this response:

{
  "errorMessages": [],
  "errors": {
    "components": "Can not deserialize instance of com.atlassian.jira.issue.fields.rest.json.beans.ComponentJsonBean out of START_ARRAY token\n at [Source: N/A; line: -1, column: -1]"
  }
}

That confirms what you found.

set

Works for both id and name, responding with status 204.

In short, the add and remove verbs no longer work. I can only conclude that to change the set of components, your client must first ask for the list, modify it client-side, then send back the modification with a set. In which case, you might just as well use the fields attribute on the PUT request, instead of bothering with the more complicated update syntax with insufficiently documented verbs.

Thank you @ibuchanan for confirmation. I’ll managed with fields attribute as you recommend.