The macro sets the amount to convert and the currencies for conversion, constructs an API URL to fetch the conversion rate, and calculates the converted amount.
#set($amount = $parameters.amount)
#set($fromCurrency = $StringUtils.lowerCase($parameters.fromCurrency))
#set($toCurrency = $StringUtils.lowerCase($parameters.toCurrency))
## API URL for conversion
#set($apiUrl = "https://api.coingecko.com/api/v3/simple/price?ids=$fromCurrency&vs_currencies=$toCurrency")
## Fetch conversion rate from the API
#set($response = $RequestManager.get($apiUrl))
## Check if response contains valid data
#if($response && $response[$fromCurrency] && $response[$fromCurrency][$toCurrency])
## Calculate the converted amount
#set($conversionRate = $response[$fromCurrency][$toCurrency])
#set($convertedAmount = $amount * $conversionRate)
## Display the conversion result
<span class="aui-lozenge aui-lozenge-subtle aui-lozenge-success">Conversion result:</span>
<p>
$amount $StringUtils.capitalize($fromCurrency) = $StringUtils.upperCase($toCurrency) $convertedAmount
</p>
#else
## Display error message if conversion fails
<p>
Unable to retrieve conversion rate
</p>
#endGet the latest cryptocurrency exchange rates for major coins
Retrieve and display current exchange rates for major currencies against a specified base currency
Parse a table containing cost and currency columns, convert each row's value into a selected target currency, and append a footer row showing the total amount. Useful for tracking multi-currency expenses and reporting totals in a unified currency.
Display the number of users who have access to each space
Display a "Delete me" message only for editors while editing a page
Show H1 headings for child topics to enable easy navigation
Exclude content from being printed or exported from Confluence pages
Show specific content to users in a particular Confluence group
Hide specific content from users in a particular Confluence group
Make sure content is included only in printed or exported versions of a Confluence page