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

This widget could not be displayed.
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
Community showcase
Posted Tuesday in Jira

What modern development practices are at the heart of how your team delivers software?

Hey Community mates! Claire here from the Software Product Marketing team. We all know software development changes rapidly, and it's often tough to keep up. But from our research, we've found the h...

84 views 0 1
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