I’m trying to set components during transition using api but I’m always gettting error.
I’m using transition post method (atlassian.com).
I’m getting error:
“errors”:{“components”:“Specify the value for components in an array”}
when I provide following data to the call:
{"update":{},"fields":{"components":{"set":{"id":"10003"}}},"transition":{"id":"51"}}
or
{"update":{},"fields":{"components":{"set":{"id":["10003","10005"]}}},"transition":{"id":"51"}}
or
{"update":{},"fields":{"components":{"set":[{"id":"10003"},{"id":"10005"}]}},"transition":{"id":"51"}}
Then I found this thread: Removing component from issue via REST API - Jira Development / Jira Cloud - The Atlassian Developer Community. I know it’s for updating not transaction, but based on the information there I’ve passed following data to the transformation:
{"update":{"components":{"set":{"id":["10003","10005"]}}},"fields":{},"transition":{"id":"51"}}
or
{"update":{"components":{"set":{"id":"10003"}}},"fields":{},"transition":{"id":"51"}}
or
{"update":{"components":{"set":[{"id":"10003"},{"id":"10005"}]}},"fields":{},"transition":{"id":"51"}}
or
{"update":{"components":{"set":{"name":"engine"}}},"fields":{},"transition":{"id":"51"}}
or
{"update":{"components":{"set":[{"name":"engine"}]}},"fields":{},"transition":{"id":"51"}}
With this approach I always get following error:
{“errorMessages”:[“Can not deserialize instance of java.util.ArrayList out of START_OBJECT token\n at [Source: com.atlassian.plugin.connect.plugin.auth.scope.InputConsumingHttpServletRequest$1@7ceab7ec; line: 1, column: 12] (through reference chain: com.atlassian.jira.rest.v2.issue.IssueUpdateBean["update"])”]}
Anyone could show me how to do it properly?
Or this functionality just doesn’t work?
Just to clarify: before the transition the component field is not set, the components field is on the screen and the data for it when I ask for transitions are as follows:
"fields": {
"components": {
"required": false,
"schema": {
"type": "array",
"items": "component",
"system": "components"
},
"name": "Components",
"key": "components",
"operations": ["add", "set", "remove"],
"allowedValues": [{
"self": "https://[project path]/rest/api/2/component/10004",
"id": "10004",
"name": "backEnd"
}, {
"self": "https://[project path]/rest/api/2/component/10003",
"id": "10003",
"name": "engine"
}, {
"self": "https://[project path]/rest/api/2/component/10005",
"id": "10005",
"name": "frontEnd"
}]
},
<other fields...>