I am attempting to automate some file uploads to a confluence page using python. I have been following this guide and was able to upload the attachment to /rest/api/content/att{ID}, but, I am stuck retrieving the page content and metadata. The code I'm using is:
headers = {"X-Atlassian-Token": "nocheck", "Accept": "application/json"}
page_output = requests.get("https://{base_url}/api/content/{Page_ID}?expand=space, metadata.labels", headers=headers, auth=('user', 'api-token'))
I have also tried using the same code without the expand, as well as expand=body.storage,version,space. However, I keep getting a 403 error, even though I am entering my user and api_token. If I put in the same url in the browser, I can see all the data there, just not when I run it in my terminal.
Any thoughts on why I might be getting this error would be greatly appreciated.
So, I think it was an issue with my vpn. New day, fresh login, and now my code is working. I also discovered that I have to have the wiki included in my url. Otherwise, I receive 404 errors...
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.