I have found Atlassian confluence REST API v2 via their docs :- https://developer.atlassian.com/cloud/confluence/rest/v2/api-group-page/#api-labels-id-pages-get
There I found api for working with Pages (specially for my usecase)
It includes multiple API’s, I’m using get Page by Id, create page, update pages.
I was able to do the things I wanted, like creating a page, updating a page.
But now I am stuck and doesn’t find anywhere a solution to it.
In confluence page UI, we have a option to add attachment, insert file.
Similarly, I wanted to add a PDF file in my confluence page, but using REST API multipart/form.
But unable to find a way to do so, found an api but I don’t know where it was attaching a file, I couldn’t find it anywhere in my page.
https://domainName.atlassian.net/wiki/rest/api/content/{page_id}/child/attachment
(I believe this is for confluence cloud ?)
It’s response also have some links on clicking it I was landing on a json page.
I need help if anyone here worked with uploading / adding a file in confluence page using REST API please let me know how it can be done.
Please let me know of any docs if any moderator/consultant from Atlassian is reading this.
Welcome to the community @Shivendra Chouksey
To create an attachment, you need to use the V1 API. Parts of the V1 API are deprecated, other parts are not. This is one of the parts that hasn't been implemented in V2 yet.
Hi @Jim Knepley - ReleaseTEAM , Thanks for sharing.
But I issue i am facing is the attachment is not reflecting under the page(pageId) against which I have send that pdf.
As per the API response it is giving some link which is taking me to a page full of json, showing my pdf name some details about when created and by me.
But it is not reflecting inside confluence page (pageId i have given).
Can you please help ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I've never seen the behavior you're describing.
If a properly structured API call to create an attachment responds as successful but doesn't result in that content appearing as part of the page, I would bring that up with Atlassian support.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I got some updates on this, as I said it is successfully uploading a pdf but unable to show it in a confluence page.
I found this uploaded pdf under attachments,
{Open the confluence page against which pdf is uploaded > Clicking on three dots, present in top right corner > Attachments > Files > Showing files I have uploaded using attachment api}.
But still this behaviour is strange, I mean If a confluence page have attachments it should show explicitly, but as of current scenario it is showing a empty clean page.
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.