Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

REST API: HTML links not intact when bringing back HTML

Blake Pitts July 30, 2018

Here is my request to get back the HTML:

https://mysite.atlassian.net/wiki/rest/api/content/60489767?expand=body.styled_view

I am getting all the content back that I would like but the links do not have their URLs attached with them. Is it possible to get the links intact as well? 

Thanks,

Blake

2 answers

1 vote
Zak Laughton
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 3, 2018

Hi Blake,

For the Confluence links in the styled_view object, I don't believe there's a way to add the full URL to the a tag, since this is how the code is written on the actual page itself. In order to add the full URL, the best workaround would probably be to find/replace any partial links with the full link after retrieving the data.

-Zak

0 votes
Zak Laughton
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 2, 2018

Hi Blake,

I tested on a page I had, but I was able to get links in the body.styled_view objects with their associated URL.

A couple questions to try to understand better:

  • Are these links to external webpages, or links to internal Confluence content (such as another Confluence page)?
  • Can you provide example HTML of a link where the URL is missing?

Thanks!
-Zak

Blake Pitts August 2, 2018

Hey Zach,

Thanks for your response. These links are to another internal Confluence page.

 

Here is the <a> I get back: 

<a  href=\ "/wiki/spaces/CCSD/pages/73334785/Diagnosing+Customer+Merge+Errors\">Diagnosing Customer Merge Errors</a>

 

It leaves off the 'https://mysite.atlassian.net/' in the beginning of the href. Is it possible to get this included with the response?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events