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?
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
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.