Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How to retrieve pages with my macro plugin?

Elier Delgado November 5, 2017

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

1 vote
Christo Mastoroudes [Adaptavist]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 6, 2017

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.

Elier Delgado November 6, 2017

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.

Christo Mastoroudes [Adaptavist]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 7, 2017

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.

Elier Delgado November 7, 2017

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
TAGS
AUG Leaders

Atlassian Community Events