Download metadata from confluence files

Deleted user January 18, 2021

I need to download the metada from each file that is in a Confluence Space or Page.

If this could be done with an API REST method it would be very helpfull.

I had search for one method in the Confluences API REST docs but I dind't found it

1 answer

0 votes
Julia Grießbach [Communardo] January 18, 2021

Hi Daniel,

maybe I can help you by showing Metadata for Confluence to you.
With it, you can add metadata to pages.
This metadata can be added as sets to whole spaces or global.

This metadata can be exported as a JSON file.
But that is only the user way to export it.
You can also use the included REST API to read the metadata using CQL.

If you have any questions feel free to contact us.

Kind regards
Julia

Deleted user January 19, 2021

Hi Julia!

 

Thanks for the answer!

 

I have a question. Does this solution requires mandatory use of CQL? I trying to do this with Python so I'm wondering if I will need to code the CQL on Python too.

Ronny Winkler January 20, 2021

Hi Daniel,

I'm not really sure if the Metadata app Julia suggested is that what you are looking for.

Could you describe in more detail what you are trying to do? Do you refer to page attachments with the "file that is in a Confluence Space or Page"? If so, what metadata do you want to retrieve for the attachments?

 

Regards

Ronny

Deleted user February 1, 2021

Hello, Ronny!

 

What I'm trying to do is to download the metadata for each file that is on a Confluence Page. I have communicated with Atlassian Support and they gave to me this url 

https://<confluence_base_URL>/rest/api/content/<content ID>?expand=space,history,body.view,metadata.labels


And it was working fine until I noticed that it only works with a Confluence Admin user and pass, which, in the prod enviroment, we don't have.

 

What I'm trying to do is to download the metada from each file from each page that a regular user have permissions to read and edit. For example:

 

I have permissions to see and edit the Knowledge space, so I download the metadata of its pages and then I download the metadata of each files in those page, which, as I said before, I already have permissions to see and edit, but the user who made the API REST call is not an admin.

Ronny Winkler February 2, 2021

Hello Daniel,

I'm not really sure that I fully understand your comment, but I'm pretty sure that the Metadata app suggested by Julia won't help you because it is a tool to add additional structured metadata to pages/blogposts in Confluence :) . 

 

You try to use the above mentioned URL to get information of Confluence pages and this works but only if you are using the login credentials of an admin user? If you use a normal user login you always get a 403 error response although the user has access to the page (i.e. he can open it in the browser)? In that case you could try to get in contact with the Atlassian support again.

Apart from that I still don't get what you mean with "metadata of each files in those page". If you refer to the attachments of a page you could try the dedicated endpoint for attachments: https://<confluence_base_URL>/rest/api/content/<content ID>/child/attachment (see https://docs.atlassian.com/ConfluenceServer/rest/7.11.0/#api/content/{id}/child/attachment).

Regards

Ronny

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events