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 votes
Accepted answer

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
Published Nov 27, 2018 in Portfolio for Jira

Introducing a new planning experience in Portfolio for Jira (Server/DC)

In the past, Portfolio for Jira required a high degree of detail–foresight that was unrealistic for many businesses to   have–in   order to produce a reliable long-term roadmap. We're tur...

2,670 views 18 21
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