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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,559,386
Community Members
 
Community Events
184
Community Groups

Is there a way to get the page information with the Confluence Rest API by the TinyUrl identifier?

Edited

Trying to use the Confluence Rest API to get some information about some pages shared internally in our company by the links. But only have the tiny URL, there is any way to get the page information from the API with this information?

For example, this is the tinyUrl https://company.com/x/D9KBF , using x/D9KBF to get the page information. I know that when I get the page information there is a field called _links that contains the tinyUrl information.

2 answers

1 accepted

@Ricardo Augusto Brito Dantas Can you please share the code here. I am looking for similar solution but not able to decode tiny url to get the page id. Thanks in advance!

def _get_confluence_page_id_from_tiny_url(self, tiny_url):
page_short_id = tiny_url.split("/")[-1:][0]
page_short_id = (
page_short_id.replace("/", "\n").replace("-", "/").replace("_", "+")
)
padded_id = page_short_id.ljust(11, "A") + "="
decoded_id = base64.b64decode(padded_id)
return struct.unpack("L", decoded_id)[0]
Like Rahul Raj likes this

@Ricardo Augusto Brito Dantas I tried the code but it is giving an error:

Traceback (most recent call last):

return struct.unpack("L", decoded_id)[0]
struct.error: unpack requires a buffer of 4 bytes

It's working after changing to

return struct.unpack("Q", decoded_id)[0]
Thank you!
0 votes
Fabio Racobaldo _Herzum_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Mar 10, 2022

Hi @Ricardo Augusto Brito Dantas ,

welcome to the Atlassian community!

are you talking about Confluence API or Confluence Rest API?

It's about the Confluence Rest API.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events