How to retrieve pages with my macro plugin?


I'm developing a macro plugin and need to retrieve pages (via the REST API) that contains my macro and the macro's content too.

My plan was to tag the pages with a content property from the macro when it is present in a page and later find those pages using CQL.

I was able to create content properties via the REST API and find those pages too.

However, I just find out that properties set by a macro are not visible to the REST API :(

Please, could you suggest a way to do what I need to?

Thank you!





1 answer


Have you considered adding a label to the page when your macro is rendered? You should be able to grab all the pages with this specific label via a rest call.

Hi Christo, I was afraid that people would remove the label but now that you mentioned I think it might work.

The macro render will get executed right after if the label is removed so it could almost guarantee that the label will be added back.

Unless the label is removed via REST but I think is good enough for what I need.

Thanks! I will let you know.

It is possible that someone could remove the label from the page, but it will be added back the next time your macro renders, which will happen each time the page is visited or refreshed.

Instead of making it seem like magic to the user you could listen for the event that removes the label and display a message to the user explaining that some functionality relies on the label and prevent its removal.

This won't prevent an admin using a app like ScriptRunner to remove or rename all the labels on all the pages though. So I think it will depend on how critical the functionality you are trying to implement is.

I will rely on labels until something more safe come out.

Thanks for your help!

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Feb 06, 2019 in Confluence

Try out the new editing experience

Hi team, I’m Avinoam, a product manager on Confluence Cloud, and today I’m really excited to let the Community know that all customers can now try out the new editing experience and see some of the ...

1,380 views 101 8
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you