Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

About adding to the page with the API of confluence

青山 明
Contributor
February 13, 2022

Is it possible to add to the confluence page using the API? It seems that it can be updated with the API, but it seems that the update must be updated by specifying the one to be added and the existing one. If you specify only the one to be added in the API update, the existing one will be deleted.

2 answers

0 votes
Nic Brough -Adaptavist-
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.
February 13, 2022

"Adding to a page" is "updating a page".  It does not delete anything, it adds a new version of the page with the new content.

青山 明
Contributor
February 13, 2022

I received an answer, but the question is how to add to an existing page. I think that it will be overwritten by the update and the existing part will disappear, but are there any options etc. that are not deleted?

Like Troy Anderson likes this
Nic Brough -Adaptavist-
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.
February 13, 2022

I am not sure what you are trying to do here.

Adding to a page IS an update.  Add and edit are the same process.  Just because you are not removing anything when you add to a page does not mean there is a different action.

青山 明
Contributor
February 13, 2022

Using the update API, it looks like this: There are two tables on the page, but the value of test1 in table1 If you update to 777, it will be updated, but the existing table2 will disappear. It seems to be overwritten. Also, for example, even if table3 is added It will be overwritten and will be the same.

Before use: Page content

              table1

                 test1 123

                 test2 456

              table2

                  test3 abc

                  test4 efg

After use: Page content

                   table1

                     test1 777

                     test2 456

Nic Brough -Adaptavist-
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.
February 13, 2022

Yes, your edit is deleting the original content.  To add to the page, add your content, don't delete.

青山 明
Contributor
February 13, 2022

I'm asking how to add it. .. ..

Nic Brough -Adaptavist-
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.
February 13, 2022

You get the content of the page, and update it with your new data.  That's what an edit or update is.

0 votes
Pramodh M
Community Champion
February 13, 2022

Hi @青山 明 

Here's an API example on how to create a new page

https://developer.atlassian.com/cloud/confluence/rest-api-examples/#create-a-new-page

And here's an example of how to update the existing page

https://developer.atlassian.com/cloud/confluence/rest-api-examples/#update-a-page

Remember when updating you need to know the ID of the page

Let me know if you have any queries

Thanks,
Pramodh

青山 明
Contributor
February 13, 2022

What I want to check is how to add to an existing page. Is there a way to overwrite or not delete in the update?

Pramodh M
Community Champion
February 13, 2022

Follow the example @青山 明 

You need to follow these steps in order to update the existing page

Make a GET call to get the page information

Also get the storage format of page which is given in the example

Now format the API to include old data and add the new content which you need to update and make a PUT call

That's it

Let me know if you have any queries

青山 明
Contributor
February 13, 2022

I understand. First of all, is it possible to update the table data defined in the page property macro?

Pramodh M
Community Champion
February 13, 2022

Yes it is possible 🙂 

青山 明
Contributor
February 13, 2022

When I get the storage format of the page property macro, the data contains double quotes and needs to be escaped. Is there any good way?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events