How do we consume the content of MS Office attachments (added through macro) in a wiki page?
Asked by Subhas Acharaya - TCS:

In the recent version upgrade of 7.9 in confluence on-premise solution we are not able to consume the HTML content data of an attachment from a wiki page through simple GET request or by calling wiki REST API end point. The first time we are getting only the tag content as "Loading" and I believe that we need to call a separate end point for fetching the content of the attachment that has been added through Wiki macro.

Can you please suggest a guide which I can follow how to construct the second API end point for fetching the content of different attachments of office software (added through macro)?


Answers:
author: Pramodh M
body: Hi [@Subhas Acharaya - TCS](/t5/user/viewprofilepage/user-id/4252213)

I checked, here's my solution.

You have to either use an attachment URL to get the data of each attachment in the page.

From API,

GET /rest/api/content/{id}/child/attachment

Please refer to this API doc

<https://docs.atlassian.com/atlassian-confluence/REST/5.8.4/#d3e2>

Thanks,  
Pramodh


author: Subhas Acharaya - TCS
body: Sorry by mistake i wrote something in the answer section. I am still searching for an answer from the community.


author: Pramodh M
body: May I know if you are referring to this?

<https://confluence.atlassian.com/doc/edit-in-office-using-the-office-connector-170493096.html>

comments: author: Pramodh M
body: And can you please give the REST API endpoint you are using


author: Subhas Acharaya - TCS
body: This is a simple HTTP GET request to any confluence or wiki page which contains a office document as attachment. In the HTML reply of the GET call we are not getting the content of the office attachment document like word, spreadsheet etc.

For example the below call:

GET [http://xxxx.yyy.dk:{port](http://xxxx.yyy.dk:{port/) num}/display/OYYZ/Positivlisten HTTP/1.1  
Authorization: Basic xxxxxx

In the wiki page <http://xxxx.yyy.dk:8090/display/OSDO/Positivlisten> we have a spreadsheet attached. In place of spreadsheet content we are getting a content like below:

\<p\>\<div class="converter-macro-ajax-container conf-macro output-block" data-hasbody="false" data-macro-name="viewxls"\>\<div style="display: none;" class="converter-macro-parameters"\>{\&quot;name\&quot;:\&quot;**Kopi af Kunder med og uden installationsaftale_161220_jk.xlsx**\&quot;,\&quot;type\&quot;:\&quot;xlsx\&quot;,\&quot;contextEntityId\&quot;:328811111}\</div\>\<div class="aui-card"\>\<p class="title"\>\<strong\>**Loading** \<span class="converter-macro-file-name"\> \</span\>\</strong\>\</p\>\<aui-spinner size="medium"\> \</aui-spinner\>\</div\>\</div\>\</p\>\<p\>\<br/\>\</p\>\<p\>\<br/\>\</p\>

It looks like we may need to make a separate GET HTTP GET call to fetch the content of the spreadsheet. This was not the behavior before the version upgrade of Wiki. We used to content in a sinle call of HTTP GET.


author: Pramodh M
body: Check under these groups once

![Atlassian Group.png](https://community.atlassian.com/t5/image/serverpage/image-id/129004i5D3233FB256B26D9/image-size/large?v=v2&px=999 "Atlassian Group.png")

Under Each User check the group they are in

![User Web UI.png](https://community.atlassian.com/t5/image/serverpage/image-id/129005i3F8C6AECFA28B7A7/image-size/large?v=v2&px=999 "User Web UI.png")

Thanks,  
Pramodh

comments: author: Pramodh M
body: FYI,

They should not be under administrators, site-admins.


author: Subhas Acharaya - TCS
body: So Pramodh,

You are suggesting that it could be an access problem that is preventing us to get the content of the attached files in HTTP GET request of a wiki page?


author: Pramodh M
body: Sorry got confused with the wrong Post!


author: Subhas Acharaya - TCS
body: Or you mean to say that some user who is in an administrator group will have this issue? whereas an user who is not in administrator group will get the content of attached files in the first HTTP GET call itself?


author: Pramodh M
body: I will try to see what the issue and respond, sorry for posting on a different question.


author: Subhas Acharaya - TCS
body: Thanks Pramodh, it will be great if you can look into my issue as it has brought a road block on our web portal delivery. Earlier we used to get the entire HTML content of a wiki page (containing the office attachments) in a single call. After version upgrade all attachments are getting replaced by a tag with content as "Loading" in the HTML file of the wiki page.


Tags: attachment

confluence-server

ms-office

server