Search code examples
restjiraconfluenceconfluence-rest-api

Fetch contents of confluence article through REST api with only the tiny URL


Is there a way to use the Confluence REST api to fetch the content of an article if all I have is the tiny url? I know how to do it if I have the page ID or the space/title, but so far I can't figure out a way to translate these tiny urls into something usable.


Solution

  • Like @mtheriault said, a workaround is necessary, you can't directly push the tiny url into the REST API. However, there's an easier way than reading the html source:

    You need one normal REST call but instead of querying the tinyurl itself, GET the following: [confluenceURL]/pages/tinyurl.action?urlIdentifier=[tinyURLFragment]. If the tiny url fragment is correct, you will get a 302 where the Location header is the fully qualified link to that page. Then you can parse the space key, page title and whatever else you need from it.