I have existing folders and files, now I need to read that directory and create file list using same manner in confluence .
for that I need to write a script for file list and to upload an attachment.How it possible with confluence ??
reply me ASAP
Hi @Vidya Shevale,
You could tweak this simple python script per your needs too and execute it from your current directory.
import os
import requests
URL = 'http://<confluence-server>/rest/api/content/<page-id>/child/attachment'
USERNAME = '<username>'
PASSWORD = '<password>'
for root, dirs, files in os.walk("."):
for filename in files:
with open(filename, 'rb') as f:
r = requests.post(URL, files={filename: f}, auth=(USERNAME, PASSWORD), headers={'X-Atlassian-Token': 'no-check'})
print(r.json())
Thanks,
Lava
Hi!
you can reuse this python module
https://github.com/atlassian-api/atlassian-python-api
Cheers,
Gonchik Tsymzhitov
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.