Project

General

Profile

Redmine can't post the content of attaching files

Added by William Defins over 8 years ago

Hi,

I'm pretty new to redmine and I'm having a hard time finding a way to post an issue with a file attached (and specially its content).

I tried to use the guide on the rest API page (link : Rest_api) :

"POST /uploads.xml
Content-Type: application/octet-stream
...
(request body is the file content)

201 response

<upload>
  <token>7167.ed1ccdb093229ca1bd0b043618d88743</token>
</upload>

Then create the issue using the upload token:

POST /issues.xml

<issue>
  <project_id>1</project_id>
  <subject>Creating an issue with a uploaded file</subject>
  <uploads type="array">
    <upload>
      <token>7167.ed1ccdb093229ca1bd0b043618d88743</token>
      <filename>image.png</filename>
      <description>An optional description here</description>
      <content_type>image/png</content_type>
    </upload>
  </uploads>
</issue>" 

I successed in posting the file, but it's empty. What kind of "request body" (and where) am I supposed to write if I want to send the content of an image or a PDF file ? I already tried to convert it to Base64 and it doesn't seem to work.

Thank you in advance for your answer.