PHP, REST API, and Multi checkboxes.

Hello,

I'm having an awful hard time getting the right JSON structor to send to JIRA via REST so that multi checkboxes are correctly set when creating a new issue in Jira.

I have data coming into an application as an JSON array and I'm then remapping it to the right custom fields in Jira and then sending it off. Ever other type of field works as expected.

A snippit from the JSON array coming into the application that contains nothing but a few checkboxes selected

array(3) {
  ["Other European"]=>
  string(14) "Other European"
  ["Middle Eastern/Latin American/African"]=>
  string(37) "Middle Eastern/Latin American/African"
  ["Other"]=>
  string(5) "Other"
}

I then add this to the JSON array that is going to JIRA using:

'customfield_11333' => ["value" => $data['Ethnicity']]

I get the error string(21) "data was not an array". I'm not really sure how I should be passing this through to Jira?

Any examples/input would be greatly appreciated.

2 answers

1 accepted

Well solved it. The correct format is of course

'customfield_11333' => [["value" => "Asian"], ["value" => "Other"]]

But required the data I had coming in to be reshaped to suit.

So I think I'm getting close with the correct syntax at least. I expected

'customfield_11339' => ["set" => ["id" => $data['Ethnicity']]],

to have worked, but still returns with data was not an array.

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published yesterday in Jira Software

How large do you think Jira Software can grow?

Hi Atlassian Community! My name is Shana, and I’m on the Jira Software team. One of the many reasons this Community exists is to connect you to others on similar product journeys or with comparabl...

281 views 4 9
Read article

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