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

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

The "components" is multi select field.

Thank you so much.



$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;

1 answer

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
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Julia Dillon
Posted Tuesday in Jira

Tell us how your team runs on Jira!

Hey Atlassian Community! Today we are launching a bunch of customer stories about the amazing work teams, like Dropbox and Twilio, are doing with Jira. You can check out the stories here. The thi...

682 views 1 18
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you