How to retrieve pages with my macro plugin?

Hello,

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

Hi,

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
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Jul 10, 2018 in Confluence

We want to see the templates you've created in Confluence!

Hi Community, Jessica here from the Confluence Product Marketing team!  July’s community challenge is all about sharing pictures  — and as an extension of our first post on what ...

805 views 23 12
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