Can't update page draft via REST API v2

Hi Atlassian,

I’m trying to update page drafts via v2 API like this.

              await requestConfluence(`/wiki/api/v2/pages/${pageId}`, {
                method: 'PUT',
                headers: {
                  Accept: 'application/json',
                  'Content-Type': 'application/json',
                },
                body: JSON.stringify({
                  id: pageId,
                  status: 'draft',
                  title: title,
                  spaceId: spaceId,
                  version: {
                    number: 1,
                  },
                  body: body,
                }),
              });

However, I’m getting an 409 error below.
(I tried with version number = current version + 1. But, it didn’t work as well)

I confirmed we can update draft pages via v1 API like this.

              await requestConfluence(`/wiki/rest/api/content/${pageId}?status=draft`, {
                method: 'PUT',
                headers: {
                  Accept: 'application/json',
                  'Content-Type': 'application/json',
                },
                body: JSON.stringify({
                  id: pageId,
                  type: 'page',
                  status: 'draft',
                  title: title,
                  spaceId: spaceId,
                  version: {
                    number: 1,
                  },
                  body: body,
                }),
              });

How can I update page draft via V2 API?

Regards,
Takafumi

3 Likes

Raised the issue with Atlassian here: https://jira.atlassian.com/browse/CONFCLOUD-76640

3 Likes

Is this working for anyone else?

I’m able to make a PUT request to update the draft content and see the result in edit mode only if the page has never been published before. On a page that has been published before, it has no effect.

:EDIT:

After discussing with Atlassian a bug ticket has been raised: https://jira.atlassian.com/browse/CONFCLOUD-77585