Can I get a Page from a tiny url in a user macro? Edited

In a Confluence user macro, I have access to the Tiny URL of a Confluence page. I'd like to get the ID of that Page, ultimately so I can iterate the descendents of that Page. So, something like:

## use $descendents...


I *thought* that the final six characters of the tiny url were the page id, Base64 encoded. But this does not work:


#set($base64=$stringUtils.substringAfterLast($url, "/"))


The Base64 decoder cannot handle the six character string, even though it was generated by the same instance of Confluence. So it seems it's not simply a Base64 number.


2 answers

Hi Damon,

You're on the right track... they are base64 encoded, but they are encoded as a bytestring. You may have some luck referencing this answer:

or maybe if I have time later today I can try to reimplement in a user macro.

I found a solution. It's rather ugly, but it works. Suggestions for streamlining this would be very welcome!






#set($identifier=$stringUtils.substringAfterLast($url, "/"))






Suggest an answer

Log in or Sign up to answer
Community showcase
Published Mar 12, 2019 in Confluence

Confluence Admin Certification now $150 for Community Members

More and more people are building their careers with Atlassian, and we want you to be at the front of this wave! Important Dates Start the Certification Prep Course by 2 April 2019 Take your e...

1,226 views 2 13
Read article

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