Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Create issue in Jira using PHP and CURL with MultiSelect Custom Field

Adams March 16, 2015

How to create an issue in JIRA for Multi Select CustomField?

The "components" is multi select field.

Thank you so much.


 

<?php

$username = 'adams';
$password = 'adams';

$url = "http://xx.xx.xx.xx:8080/rest/api/2/issue/";

$data = array(

'fields' => array(
'project' => array('key' => 'MYAPI',),
'summary' => 'This is summary',
'description' => 'This is description',
"issuetype" => array("name" => "Task"),
"reporter" => array("name" => "adams"),
//"components" => array("name" => "HW")
),

);
$ch = curl_init();
$headers = array(
'Accept: application/json',
'Content-Type: application/json'
);

$test = "This is the content of the custom field.";
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
//curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_USERPWD, "$username:$password");
$result = curl_exec($ch);
$ch_error = curl_error($ch);

if ($ch_error) {
echo "cURL Error: $ch_error";
} else {
echo $result;
}
curl_close($ch);
?>


1 answer

0 votes
Norman Abramovitz
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.
March 16, 2015

You will probably be better off asking a PHP website how to do a multiple select field.

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, jira product discovery, jpd premium, product management, idea management, product discovery, jira premium, product planning, atlassian community, product development, roadmap planning, product prioritization, feature management

Introducing Jira Product Discovery Premium ✨

Jira Product Discovery Premium is now available! Get more visibility, control, and support to build products at scale.

Learn more
AUG Leaders

Atlassian Community Events