Its throwing an error "priority":"Could not find valid 'id' or 'name' in priority object.
I need to retrieve the form values and create tickets in JIRA on submit. I am able to retrieve the description field from the form, but not the priority and other custom fields. See below.
I have referred to the API, still no luck.
Is this even a valid way of setting the form values.
$new_issue = array(
'fields' => array(
'project' => array('key' => 'somevalue'),
'summary' => somevalue',
'description' => $_POST['description'],
'priority' => $_POST['priority'],
'issuetype' => array('name' => 'somevalue'),
)
);
Community moderators have prevented the ability to post new answers.
The JSON sample is on JIRA REST API page near /rest/api/2/issue POST, https://docs.atlassian.com/jira/REST/latest:
{ "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" } }
If mean PHP sample fro creating JSON, then you need to consult some PHP resources.
thank you so much. I am stuck at retrieving the html form value and writing to the array before creating JSON.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you for responding. I am new to writing json code and unclear how to use this. Do you have a full code example that you can post here, please?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
As I understand you use /rest/api/2/issue POST JIRA REST method.
The priority JSON portion should look like:
priority: {"name" : "High"}
Or if you pass id:
priority: {"id" : 123}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Community moderators have prevented the ability to post new answers.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.