Project

General

Profile

REST Wiki API: file uploading

Added by Artsiom Yemelyanenka about 10 years ago

Hello, I'm trying to create a Wiki page using REST API.
The page is created, but no files are attached.
I perform the following sequence of requests (below).

How can I attach a file to a wiki page in Redmine using REST API?

1)

POST /uploads.xml

<?xml version="1.0" encoding="UTF-8"?><upload><token>4.0aa1a60c74216523e275e92da1bc382a</token></upload>

2)

PUT /projects/test/wiki/Wiki.xml
<?xml version="1.0"?>
<wiki_page>
<text>Example 18.9cade8a56871e4867c97b5fbe2842f08</text>
<comments>Typo</comments><uploads type="array">
<upload>
<token>18.9cade8a56871e4867c97b5fbe2842f08</token>
<filename>test.png</filename>
<description>An optional description here</description>
<content_type>image/png</content_type>
</upload>
</uploads>
</wiki_page>

status=200, reason=OK