I’m developing my first plugin using the Atlassian Plugin SDK, and I’m also new to Java. Please forgive my newbishness.
I am developing a plugin for Confluence that uses the xhtml-macro
module and has two parameters: Name
and Date
:
<xhtml-macro name="validator" class="com.vimeo.community.validator.macro.validator" key='validator-macro'>
<description key="validator.macro.desc"/>
<category name="formatting"/>
<parameters>
<parameter name="Name" type="string" />
<parameter name="Date" type="string" />
</parameters>
</xhtml-macro>
The macro uses these parameters to display the following message in articles:
{Name} validated this article on {Date}.
[Validate now]
When the end-user clicks the [Validate now] button, I want to update the two macro parameters with the current user’s name, and the timestamp on which the button was clicked. I’ve set up an event handler in the JS for that button click, but now I am stumped.
I imagine that maybe there’s a way to build an API endpoint for the macro that would be able to modify the parameters based on values sent with the request. If that’s the best way forward, should I be using the rest
module? Or am I barking completely up the wrong tree?
Also, which method(s) can I use to set the values of my macro’s parameters programmatically?
Finally, if anyone knows of any examples of plugins that perform a similar task to mine, and can point me toward the source code, I’d be very grateful.
Thanks in advance!