Rest API how to disable page creation/update notifications

Sukhjinder Bhullar March 3, 2020

Hello,

I am using confluence rest api and python module requests to create multiple pages in confluence. my tool has to run every day and delete old pages and create new pages with details. 

problem is while it creates new page it also send notification to the watcher of space. I do not want to send notification to watcher of space for new page creation.. 

code sample: 

invpagebodyhtml = "<p><b>This page is published by automation tool.</b></p>"
create_page = json.dumps(    {        "type""page",        "title""testing-notification",        "space": {"key""TEST"},        "ancestors": [{"id"1234567}],        "status""current",        "body": {"storage": {"value": invpagebodyhtml, "representation""storage",}},    })

 

response = requests.request(    "POST", URL, data=create_page, headers=headers,)

it creates the page but I could not find way to disable notification at time of page creation. 

As per my research on internet, I found https://community.atlassian.com/t5/Confluence-questions/Prevent-notifications-when-using-REST-API/qaq-p/948058 which says feature is not supported for page creation however minorEdit : true can be used for disabling notification for update on pages which I am looking for. 

any help here please? 

Thanks

Sukh

2 answers

1 accepted

0 votes
Answer accepted
Daniel Eads
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 6, 2020

Hey Sukh,

I can confirm that there's currently no notification suppression for page creation via API in Confluence Cloud. You can get more details about the feature request on our public Jira: https://jira.atlassian.com/browse/CONFCLOUD-38804

Thinking about your request, I have two ideas on how to stop the notifications:

  1. Do you need to delete the old pages and create new ones, vs simply updating the existing pages? If you could update the pages instead, you could make use of the 
    "minorEdit" : true

    parameter which would suppress notifications. If there's not a strong reason to delete the pages, this would be the easier approach.

  2. If these new pages all have the same parent, you could restrict the parent page while your script is running. As these new pages would be created in a restricted section, notifications would not be triggered for users without access. Your script would need to do the following:
    1. Restrict the parent page (Restriction call in the REST API) to be only visible to the user running the script
    2. Do the current delete/create process you have in your existing script
    3. Un-restrict the parent page

Although not as straightforward as just adding a parameter for page creation, I think you can get your desired results using one of these two methods.

Cheers,
Daniel

Sukhjinder Bhullar March 26, 2020

Thanks Daniel. We could suppress it by throwing users out of watching of space :) 

0 votes
Chris P. April 28, 2021

Thanks guys > did the same thing.

This was an issue for us when we were only updating attachments via API (vs content with a body).

Tried with both:

"minorEdit" : True

and

"minorEdit" : False 

included in API call data field, and it would still notify watchers via email.

 

Solution was to remove all watchers, update attachments, and the re-add the watchers back to affected pages.

 

Resources:

Get watches for page 

Remove watches for page 

Add content watcher 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events