Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Upload attachment to comment using REST API

Daria Kozhemiakina July 29, 2021

I am uploading attachments using api/content/{id}/child/attachment route via node js. Uploading to pages or blog posts works like a charm but when I try to upload attachment to a comment with the same code i receive {"statusCode":500,"message":"","reason":"Internal Server Error"} as a response. What can be the reason? Can we upload attachments to comments using REST API in general? If yes, I can provide more details about how I make request

1 answer

0 votes
Kishan Sharma
Community Champion
July 31, 2021

Hi @Daria Kozhemiakina  welcome to the community. I tried doing this but get 403 response with below error -

"message":"User not permitted to create attachments for content: ContentId{id=123456}","reason":"Forbidden"}

As per the REST API documentation -

  • STATUS 403Returned if attachments is disabled or if you don't have permission to add attachments to this content.
Daria Kozhemiakina August 4, 2021

Hello @Kishan Sharma 
Thank you for an answer, but unfortunately I am not sure if it is relevant to the situation. Do you have permissions to add a comment by the user you authorized to use an api? 403 error according to Confluence api docs means that you don't have rights to perform an action. While my error is 500 with no explicit info in message ;(

Kishan Sharma
Community Champion
August 4, 2021

Hi @Daria Kozhemiakina . Yes I do have permissions to add comment to the page where i am trying to add a comment + attachment. Somehow I am unable to get through it.

Daria Kozhemiakina August 5, 2021

Hello @Kishan Sharma  Got it, thank you
Are you able to add attachments to pages or blogposts in the same way or receive 402 too?

Kishan Sharma
Community Champion
August 5, 2021

Hi @Daria Kozhemiakina i was able to add an attachment to a page, without any error. Are you getting any issues while adding attachment to a page ?

Daria Kozhemiakina August 5, 2021

@Kishan Sharma Nope. I can add to pages and to blogposts also, but when I try to add an attachment to the comment - 500 error, when with GUI(confluence itself) it is possible to add attachments to comments

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events