Trouble with addAttachment method using Light Protocol

I want to add an attachment to a page in Confluence, preferably by using the Light Protocol that encodes the method name in the URL.

I have constructed the following JSON code, which should create a very simple text file:

[ 2339970
, { "fileName" : "Testfile.txt"
  , "contentType" : "text/plain"
  , "comment" : "to be ignored"
, "VGhpcyBpcyBhIHRlc3QuClRvIENvbmZsdWVuY2Ugb3Igbm90IHRvIENvbmZsdWVuY2U/Cg=="

The third parameter is a base64 encoded string.

Unfortunately I get an error message from the server:

      <data null="true"/>
      <message>Request parameter types did not match method parameter types (method addAttachment taking 3 parameters)</message>

Any idea what I'm doing wrong here?

3 answers

I am having this same issue with the json-rpc light protocol. Have you found a solution yet?

No, I eventually gave up on it. Sorry...

While I was not able to resolve this issue myself using the Light Protocol, I did successfully upload an attachment using the REST API.

The URL for uploading attachments is "<host:port>/confluence/rest/api/content/<page id>/child/attachment". Specific details for what data to send up can be found in Atlassian's Confluence REST API documentation.

Thank you for your answer, Stephen. I guess I'll have to try your direction for solving this issue.

Suggest an answer

Log in or Join to answer
Community showcase
Louis De Jaeger
Posted yesterday in Off-topic

Friday fun: your best joke

Hi all Lets make this Friday fun really fun and post one (or more) of your best jokes! The joke can be about an Atlassian product, or just a really fun joke you want to share! I’m not the best j...

158 views 12 3
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot