Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Checkboxes through the REST-API

Marvin_Müller January 30, 2020

Hi,

i try create some confluence pages through the REST-API. It's working with bold, sections etc very well, but checkboxes like this is a little trouble.

Screenshot_2020-01-30 System 20 1 - APP Program - Confluence ITS.png

 

With the editor, its very easy using these brackets: []. But through the REST-API this is not possible, the will shown as plain text. Is there any solution for sending checkboxes through the API? i know its possible with the tasklist-macro, but if its possible i want to use the normal checkboxes.

 

 






















 

1 answer

0 votes
David_Bakkers
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 4, 2020

A single checkbox will have only two values: on or off.

If you set the customfield's value to nothing (null) it will turn off.
If you set the customfield's value to Y, it will turn on, as in...

{ "fields" : { "customfield_12345" : { "value" :"Y" } } }
David_Bakkers
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 4, 2020

Ignore my answer above. I just realised you are asking a question about a Confluence page, not a Jira issue.

You can't alter a single checkbox on a Confluence page. You'd have to use the REST API to download the page content in HTML format, search for the checkbox you want to change, change its status from incomplete to complete, then upload the whole page of HTML back to Confluence to apply the change.

Here's a sample of the HTML for a task list with two tasks, one complete (ticked), one incomplete (un-ticked):

<ac:task-list>
<ac:task>
<ac:task-id>1</ac:task-id>
<ac:task-status>complete</ac:task-status>
<ac:task-body>
<span class="placeholder-inline-tasks">task is complete</span>
</ac:task-body>
</ac:task>
<ac:task>
<ac:task-id>2</ac:task-id>
<ac:task-status>incomplete</ac:task-status>
<ac:task-body>
<span class="placeholder-inline-tasks">task is incomplete</span>
</ac:task-body>
</ac:task>
</ac:task-list>

 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events