I can't understand what I'm missing
Without "component" filed it works just fine, but I can't create issue with defined component.
It gives me "components => string 'data was not an array'" error.
$new_issue = array(
'fields' => array(
'project' => array('id' => '10602'),
'summary' => 'TEST',
'issuetype' => array('id' => '3'),
'reporter' => array('name' => 'myname'),
'components' => array('id' => '10705'),
)
);
Community moderators have prevented the ability to post new answers.
Hi Roman,
You'll actually need to pass the Components field as an array instead of simply adding it as an element to the new_issue array. Take a look in the example of the /rest/api/2/issue REST API:
{ "update": { "worklog": [ { "add": { "started": "2011-07-05T11:05:00.000+0000", "timeSpent": "60m" } } ] }, "fields": { "project": { "id": "10000" }, "summary": "something's wrong", "issuetype": { "id": "10000" }, "assignee": { "name": "homer" }, "reporter": { "name": "smithers" }, "priority": { "id": "20000" }, "labels": [ "bugfix", "blitz_test" ], "timetracking": { "originalEstimate": "10", "remainingEstimate": "5" }, "security": { "id": "10000" }, "versions": [ { "id": "10000" } ], "environment": "environment", "description": "description", "duedate": "2011-03-11", "fixVersions": [ { "id": "10001" } ], "components": [ { "id": "10000" } ], "customfield_60000": "jira-developers", "customfield_20000": "06/Jul/11 3:25 PM", "customfield_80000": { "value": "red" }, "customfield_40000": "this is a text field", "customfield_30000": [ "10000", "10002" ], "customfield_70000": [ "jira-administrators", "jira-users" ], "customfield_50000": "this is a text area. big text.", "customfield_10000": "09/Jun/81" } }
While Summary is:
"summary": "something's wrong",
The Components field is:
"components": [ { "id": "10000" } ]
Does that make sense?
yes, thanx, I've seen this) but I don't know what I should change in my code, I'm not really good at php, 'components' => array('id' => '10705'), maybe you can help me a little bit with syntax, please?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
oh, I did it, I had just put additional [] brackets to components, thanx again!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey Roman, I'm glad to hear that! :) You are most welcome!
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.