Ticking Checkbox Upon Issue Creation via REST API - Jira Python

Viewed 255

I would like to seek help on ticking checkboxes upon issue creation via rest API.

I have three checkboxes:

CheckBox1

CheckBox2

CheckBox3

Each checkbox have same name ,customfield_10000 , but different id.

CheckBox1 - id : customfield_10000-1 | value : 10700

CheckBox2 - id : customfield_10000-2 | value : 10701

CheckBox3 - id : customfield_10000-3 | value : 10702

Lets say I want to tick Checkbox 1 upon creation of issue via rest api.

My current code:

{ "customfield_10000 " : [
        {
            "value" : "10700",
            "id" : " customfield_10000-1"
        }
    ]
}

Result:

'error': {'customfield_10000 ': "Option value '10700' is not valid"}

I tried to put "Y" on value but I also got an Error:

'Error', 'error': {'customfield_10000 ': "Option value 'Y' is not valid"}

Thank you!

1 Answers

From my understanding, when updating a checkbox custom field, don't think of each individual checkbox as their own field. As such, when setting the value of the field, you can't interact with each individually, instead you have tell the field which boxes should be ticked and which should not each time you update it.

To do this you just need to provide the names of the ticked checkboxes

{ "customfield_10000" : 
    [
        { "value" : "CheckBox1"}
    ]
}

The above will tick just CheckBox1

{ "customfield_10000" : 
    [
        { "value" : "CheckBox1"},
        { "value" : "CheckBox3"}
    ]
}

The above will tick CheckBox1 and CheckBox3

Related