api/2/field create multiselect field Edited

I'm trying to create a new multiselect field using the REST api/2/field POST endpoint. I would like to populate the options of this multiselect as part of the request. I can't find any info on whether its possible to populate those options and, if it is possible, what the JSON object property is called and what key-value pairs I should be using. Here's the PHP & cURL request data/body I have tried:

$data = array(
"name" => "Test Customer List",
"description" => "Custom test field for picking customers",
"type" => "com.atlassian.jira.plugin.system.customfieldtypes:multiselect",
"searcherKey" => "com.atlassian.jira.plugin.system.customfieldtypes:multiselectsearcher",
"options" => array(
"value" => "test1",
"value" => "test2",
"value" => "test3",
),
);
$data = json_encode($data);

 Here's the error I'm getting in the response:

[errorMessages] => Array
(
[0] => Unrecognized field "options" (Class com.atlassian.jira.rest.api.customfield.CustomFieldDefinitionJsonBean), not marked as ignorable
at [Source: org.apache.catalina.connector.CoyoteInputStream@3ddbcd03; line: 1, column: 254] (through reference chain: com.atlassian.jira.rest.api.customfield.CustomFieldDefinitionJsonBean["options"])
)

If there is no way to set the options using this endpoint, what would be the alternative for populating this field programmatically upon or after creation?

1 answer

1 accepted

0 vote
Alexey Matveev Community Champion Dec 07, 2017

Hello,

It is not possible for Jira Server, but for Jira Cloud you can use api/2/field/{fieldKey}/option

https://docs.atlassian.com/software/jira/docs/api/REST/1000.1568.0/#api/2/field/{fieldKey}/option

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...

175 views 1 17
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