About adding to the page with the API of confluence
Asked by ?? ?:

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.


Answers:
author: Nic Brough -Adaptavist-
body: "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.

comments: author: ?? ?
body: 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?


author: Nic Brough -Adaptavist-
body: 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.


author: ?? ?
body: 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


author: Nic Brough -Adaptavist-
body: Yes, your edit is deleting the original content. To add to the page, add your content, don't delete.


author: ?? ?
body: I'm asking how to add it. .. ..


author: Nic Brough -Adaptavist-
body: You get the content of the page, and update it with your new data. That's what an edit or update is.


author: Pramodh M
body: Hi [@?? ?](/t5/user/viewprofilepage/user-id/4679103)

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

comments: author: ?? ?
body: 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?


author: Pramodh M
body: Follow the example [@?? ?](/t5/user/viewprofilepage/user-id/4679103)

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


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


author: Pramodh M
body: Yes it is possible ?


author: ?? ?
body: 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?


Tags: cloud

confluence-cloud