You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
According to the API documentation all I need to supply is a value for "minorEdit" and "file" with a filepath, but even if I provide no body at all I get the same error "...BadRequestException: At least one attachment file must be included". I wondered if maybe it needs the ACTUAL file not just the path so I tried including content type and base64 encoded text of my image. Also wondered why the documentation says "relative file path"... relative to what? But I'm thinking it's failing before that point altogether: I don't think I'm constructing the body content correctly: does this LOOK correct?
Content-Disposition: form-data; name="minorEdit"
Content-Disposition: form-data; name="file"
Or I found this post Solved: Uploading attachment into Confluence (atlassian.com) which seems to include the actual file content in the post (although it doesn't mention that on the API documentation, that seems more logical?) but that doesn't work either? Should I try different characters for carriage return new line perhaps?
OK got it working in the end.
Content-Disposition: form-data; name="file" ; filename="hmmmm.jpg"
Was using VBA (one off migration task) hence the need for manually constructing the body (using MSXML2.XMLHTTP60). This is why postman is nice: it's a lot easier to use these days I found too. Just setup auth = "API Key" and put Key = "Authorization" and Value = "Basic [and your base64 encoded username:api-key you got from your Atlassian profile]". Click the little </> icon on the right to view the code snippets: select the "HTTP" one to kinda see the raw info that you can mimic for VBA. Took me 10 minutes to get working in postman and a full day to get working in VBA lol. Hope this helps someone!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.