Project

General

Profile

rest wiki_page with attachment using XML

Added by Emil Jansen about 8 years ago

Hello everyone,

How can I upload a wiki page with an attachment as XML using REST.

The page https://www.redmine.org/projects/redmine/wiki/Rest_WikiPages has an example that uses json:

PUT /projects/project_name/wiki/wiki_name.json
{
    "wiki_page": {
        "text": "This is a wiki page with images (like this: !img.png!), and other files." 
    },
    "attachments": [
        {"token": "7167.ed1ccdb093229ca1bd0b043618d88743", "filename": "img.bmp", "content-type": "image/png"},
        {"token": "7168.d595398bbb104ed3bba0eed666785cc6", "filename": "document.pdf", "content-type": "application/pdf"}
    ]
}

I want to upload a wiki_page with attachment in XML. How can I do that ?

I tried:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<wiki_page> 
    <text>some text</text>
    <attachments type="array">
       <attachment>
          <token>1317.552e21cd4cd9918678e3c1a0df491bc3</token>
          <filename>text.txt</filename>
          <content-type>text/xml</content-type>
       </attachment>
    </attachments>
</wiki_page>

The page is created. But the attachment does not exist. The attachment does not exist in the browser and if the page is retrieved using the rest interface it does not exist in the response too.

(The attachment was uploaded without a problem)

What is the correct xml syntax to upload a wiki_page with attachment using REST ??

Emil.