Forums

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

How to use the Share-Page plugin REST API?

Daniel Kühner April 15, 2020 edited

Hi,

I am writing a Confluence User-Macro and I want to "notify" our users. I have searched for sending mails / notifications or something like this but I could not find anything. Then I spotted the "Share"-Button on the pages.

I did some research and found the REST call to:

POST /rest/share-page/latest/share

With a payload of the format of:

{
"users": [],
"emails": [],
"groups": [],
"note": "",
"entityId": "",
"entityType": "",
"contextualPageId": ""

Then I have searched the web for the documentation of the REST API of "com.atlassian.confluence.plugins.share-page" but I could not find anything.

I have spotted the plugin at https://packages.atlassian.com/webapp/ but without any hints about the REST API. JavaDoc is empty and no source code.

Found this through: share page. any events fired ? 

Can you please provide / share me the documentation of the REST API of this plugin?

Thanks, Daniel

1 answer

0 votes
Wolfgang Lutz
Contributor
December 16, 2022

Try this:

---------------------------------

<button id="shareIT" class="aui-button aui-button-primary">share it</button>

<br>
<hr>

<script type="text/javascript">
AJS.toInit(function() {

jQuery("#shareIT").click(function() {  

var jsondata = {
//users: ["123c02b50038b550150038e09de1cc1"],
contextualPageId: "3942484297",
emails: ["example@test.com"],
entityId: "3942484297",
entityType: "page",
//groups: [],
note: "A example page"
};

jQuery.ajax({
type: "POST",
url: "/rest/share-page/latest/share",
contentType:"application/json; charset=utf-8",
dataType: "json",
async: false,
data: JSON.stringify(jsondata),
success: function () { alert('Page shared with ' + jsondata.emails); },
fail: function () { alert('Error'); }
});

/*******************************************************/

} );  
</script>

---------------------------------

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, likes for trees, atlassian community, social impact, tree planting campaign, community kudos, atlassian giving, environmental impact, sustainability, likes for good, atlassian social responsibility, community challenge

Make every click count—help us plant 50,000 trees! 🌳

Want to make your everyday Community actions directly contribute to reforestation? The Atlassian Community can achieve this goal by liking a post, attending an ACE, sending your peers kudos, and so much more!

Help us plant more trees
AUG Leaders

Atlassian Community Events