I need a script to upload attachment to docupedia

Hagar Mohamed January 9, 2023

I need a python script in order to upload a file to docupedia page, how could I make that?

 

2 answers

0 votes
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 9, 2023

There's a doc on using the REST API to attach files to Confluence Server over at https://confluence.atlassian.com/confkb/using-the-confluence-rest-api-to-upload-an-attachment-to-one-or-more-pages-1014274390.html

It's not Python, you'll need to find Python code that can make REST calls, but that doc tells you what content you'll need to be sending.

Hagar Mohamed January 10, 2023

when I run this command,

curl -u username:password -X POST -H "X-Atlassian-Token: nocheck" -F "file=file_name" https://inside-docupedia.company_name.com/confluence/rest/api/content/page_id/child/attachment | jq -r '.results[].title'

this error pops up to me

parse error: Invalid numeric literal at line 1, column 10

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 10, 2023

That looks like a jq error - try removing the pipe to jq from the command to see what curl is actually getting.

Hagar Mohamed February 14, 2023

it gets me this error 


{"statusCode":403,"data":{"authorized":false,"valid":true,"allowedInReadOnlyMode":true,"errors":[],"successful":false},"message":"User not permitted to create attachments for content: ContentId{id=2686483136}","reason":"Forbidden"}

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 14, 2023

Ok, so either you don't have permission to create attachments in the space, or your login is incorrect.

Hagar Mohamed February 15, 2023

but when I use GET, it works fine 

0 votes
Alex Koxaras _Relational_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 9, 2023

Hi @Hagar Mohamed and welcome,

Perhaps you are not on the right community asking the right questions..

Can you explain more the need you have in regards to Confluence? How confluence relates to docupedia? How have you integrated the two systems?

Hagar Mohamed January 9, 2023

docupedia is a part of confluence, our company ask confluence to make it for us,
https://inside-docupedia."our company name".com/confluence/ this is the URL

Alex Koxaras _Relational_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 9, 2023

Ah! It seems that you have installed confluence inside a domain, but I honestly do not know the answer to your question.

Hagar Mohamed January 9, 2023

thank you, is there another place should I ask my question in?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events