Copy an attachment from one page to another and/or change the filename
Name | Type | Description |
fileid | int | identifies a file by ID |
Name | Type | Description |
authenticate | bool? | Force authentication for request (default: false) |
name | string? | new filename |
to | string? | page id of target page |
Name | Value | Description |
OK | 200 | The request completed successfully |
Bad Request | 400 | Invalid input parameter or request body |
Forbidden | 403 | Update access to the page is required |
Not Found | 404 | Requested file could not be found |
A file cannot be copied to a template page or a destination page that already contains a file with the same name.
The first example copies file with id 20 to page with id 213. The second example does the same except it renames the newly created file to "newname.txt"
curl -u username:password -d "" -i http://mindtouch.address/@api/deki/files/20/copy?to=213
curl -u username:password -d "" -i "http://mindtouch.address/@api/deki/files/20/copy?to=213&name=newname.txt"
In this example we will copy an attachment (id: 20) to the destination page (id: 456) and rename the file to "hello.txt".
curl -u admin:password -d "" -i "http://mindtouch.address/@api/deki/files/20/copy?to=456&name=hello.odt"
HTTP/1.1 200 OK Date: Wed, 16 Mar 2011 23:08:44 GMT Server: Dream-HTTPAPI/2.3.0.113 Microsoft-HTTPAPI/2.0 Content-Length: 997 Content-Type: application/xml; charset=utf-8 X-Data-Stats: request-time-ms=119; mysql-queries=24; mysql-time-ms=55; X-Deki-Site: id="default" Via: 1.1 mindtouch
Content-Type: application/xml
<file id="31" revision="1" href="http://devvm/@api/deki/files/31/info"> <filename>hello2.odt</filename> <description/> <contents type="application/vnd.oasis.opendocument.text" size="29036" href="http://devvm/@api/deki/files/31/=hello2.odt"/> <date.created>2011-03-16T23:11:47Z</date.created> <user.createdby id="1" href="http://devvm/@api/deki/users/1"> <nick>Admin</nick> <username>Admin</username> <fullname/> <email>noreply@mindtouch.com</email> <hash.email></hash.email> </user.createdby> <revisions count="1" totalcount="1" href="http://devvm/@api/deki/files/31/revisions"/> <page.parent id="456" revision="1" href="http://devvm/@api/deki/pages/456?redirects=0"> <uri.ui>http://devvm/talk17</uri.ui> <title>talktest</title> <path type="custom">talk17</path> <namespace>main</namespace> </page.parent> </file>