Add option to custom field via API

Hi,
i have a custom field with several options defined. I took the context. I updated an option. ok.
But if i want to add an option… how i can choose the new id??

I’m using:
https://myfactory.atlassian.net/rest/api/3/field/customfield_10171/context/10319/option

With this body
{
“options”: [
{
“disabled”: false,
“id”: “???”, <----- wich number i have to use? can’t be void
“value”: “MickyMouse”
}
]
}

Thank you :slight_smile:

Hi @MassimilianoStretti ,

Welcome to the Atlassian Developer Community.

You should be able to use the POST /rest/api/3/field/{fieldId}/context/{contextId}/option endpoint to create custom field options.

For each new option, you only need to provide a value field and the response will return the options with the IDs allocated.

Regards,
Dugald

1 Like

Hi @dmorrow

I was using PUT as a verb; using POST works!

POST works to insert
PUT works to update

Great! Thank you!!