Provide dynamic configuration (properties) for macro

Hi guys,

I have created a simple Macro which makes REST calls to specific points, gets the infomration and shows them on page. Pretty simple.

Now the thing is: i want to make it possible to the clients (who ever uses my macro) to be able to define the REST endpoint base URL once per confluence server.
Then i can read this property in my code and use it as base URL for REST requests.

What is the “Confluence way” of providing simple configuration properties that are required for a Macro? Can it be controlled somewhere in the Administration GUIO of confluence. This makes it easy for who ever installs the macro to configure the base URL. Base URL is defined once per Confluence server (confluence/macro instalation).

Thank you for your time.
Branislav Vidovic

I don’t know if Confluence has such a configuration. However, I can suggest the following.
1- If you want to get a Confluence base URL, you can use this AJS.Confluence.getBaseUrl(). The base URL is unique to the instance.
2- If you want them to manually provide a baseURL then you can provide a field where they can set it. For example, you can provide them an admin page with input field and submit button, once submitted, you store it, and then retrieve it everytime you are making a request.
For creating the admin page I suggest you see this xwork
For storing, you can read how to store plugin settings and Bandana.

I hope this helps.

Thank you very much. It is helpfull.