Skip to main content
NiCE KnowledgeKnowledge

On October 21, we applied a security patch across all NiCE KM production environments to address a recently disclosed PHP vulnerability. The update was completed without service disruption, and our team continues to monitor the platform closely. No action is required on your part.

NiCE Knowledge Success Center

site/export (POST)

Overview

Generates export information

  • REST Method: POST
  • Method Access: public

Query Parameters

Name Type Description
relto int? Page used for path normalization (default: home page)
reltopath string? Page used for path normalization. Ignored if relto parameter is defined.
format string? Format used for exporting page (one of 'xhtml', 'dekicode'; default: xhtml)

Return Codes

Name Value Description
OK 200 The request completed successfully
Bad Request 400 Invalid input parameter or request body

Message Format

Input:

<export>
  <pages> 
     <page path="{text}" recursive="{bool}" exclude="none|files,props,tags,talk|all" />
     <page id="{int}" recursive="{bool}" exclude="none|files,props,tags,talk|all" />  
      ...
     <file id="{int}" exclude="none|props|all" />
   </pages>
</export>

Output:

<export>
  <requests>
    <request method="GET" href="http://host/@api/deki/pages/{id}/contents?reltopath={path}&format=xhtml" dataid="{text1}" >
      <header name="{text}" value="{text}" />
      ...
    </request>
    <request method="GET"  href="http://host/@api/deki/pages/{id}/tags" dataid="{text2}">
      <header name="{text}" value="{text}" />
      ...
    </request>
    <request method="GET"  href="http://host/@api/deki/pages/{id}/properties/{name}" dataid="{text3}">
      <header name="{text}" value="{text}" />
      ...
    </request>
    <request method="GET"  href="http://host/@api/deki/files/{id}" dataid="{text4}">
      <header name="{text}" value="{text}" />
      ...
    </request>
    <request method="GET"  href="http://host/@api/deki/files/{id}/properties" dataid="{text5}">
      <header name="{text}" value="{text}" />
      ...
    </request>
    ...
    <warning reason="{text}" status="{httpstatus}">
      <page path="{text}" recursive="{bool}" exclude="none|files,props|all" />
    </warning>
    ...
  </requests>
  <manifest version="{version}">
    <page dataid="{text1}">
      <title>{text}</title>
      <path>{page path using // to indicate relativity to base export page}</path>
      <language>{text}</language>
      <contents type="{mimetype}"/>
    </page>
    <tags dataid="{text2}">
      <path>{page path using // to indicate relativity to base export page}</path>    
    </tags>
    <property dataid="{text3}">
      <name>{text}</name>
      <path>{page path using // to indicate relativity to base export page}</path>
      <contents type="{mimetype}"/>
    </property> 
    <file dataid="{text4}">
     <filename>{text}</filename>
     <path>{page path using // to indicate relativity to base export page}</path>
     <description>{text}</description>
     <contents type="{mimetype}" />
    </file>
    <property dataid="{text5}">
     <name>{text}</name>
     <filename>{text}</filename>
     <path>{page path using // to indicate relativity to base export page}</path>
     <contents type="{mimetype}"/></property>...  
  </manifest>
</export>

Implementation Notes

The requests section of the returned document describes the HTTP requests to make to perform the actual export.

Curl Code Sample: Export Page/Files

The following command requests export instructions for pages/files listed in "export.xml".

Sample Code

curl -u admin:password -H "Content-Type: application/xml" -d @export.xml -i http://mindtouch.address/@api/deki/site/export

Implementation notes 

curl flags

-u
Basic HTTP authentication. Sends a username and password to server so it can verify whether a user is of privilege to perform specific operation.
-d @file
Specifies a POST request and file to send.
-H
Replaces or appends an HTTP header. The "Content-Type" header specifies the MIME type of the value attached to the property. In this case, use application/xml since the document being passed is of type XML.
-i
Includes the HTTP response header in the output. Useful for debugging.

Example

This example demonstrates how to export the instructions for several pages and a file.

export.xml

Content-Type: application/xml

<export>
  <pages>
	<page path="Test" recursive="true"/>
	<page id="567"/>
	<page path="FUBAR"/>

	<file id="71"/>
  </pages>
</export>

Sample Code

curl -u admin:password -H "Content-Type: application/xml" -d @export.xml -i http://192.168.59.128/@api/deki/site/export

HTTP Response Headers

HTTP/1.1 200 OK
Date: Tue, 26 Jan 2010 00:17:21 GMT
Server: Dream-HTTPAPI/2.0.0.17629 Microsoft-HTTPAPI/2.0
Content-Length: 2162
Content-Type: application/xml; charset=utf-8
X-Data-Stats: request-time-ms=50; mysql-queries=50; mysql-time-ms=41;
X-Deki-Site: id="default"
Via: 1.1 dekiwiki

HTTP Response Body

Content-Type: application/xml

<export>
  <requests>
    <request method="GET" href="http://192.168.59.128/@api/deki/pages/562/contents?redirects=0&mode=edit&reltopath=&format=xhtml" dataid="0"/>
    <request method="GET" href="http://192.168.59.128/@api/deki/pages/562/tags?redirects=0" dataid="1"/>
    <request method="GET" href="http://192.168.59.128/@api/deki/pages/563/contents?redirects=0&mode=edit&reltopath=&format=xhtml" dataid="2"/>
    <request method="GET" href="http://192.168.59.128/@api/deki/pages/563/tags?redirects=0" dataid="3"/>
    <request method="GET" href="http://192.168.59.128/@api/deki/pages/564/contents?redirects=0&mode=edit&reltopath=&format=xhtml" dataid="4"/>
    <request method="GET" href="http://192.168.59.128/@api/deki/pages/564/tags?redirects=0" dataid="5"/>
    <request method="GET" href="http://192.168.59.128/@api/deki/pages/567/contents?redirects=0&mode=edit&reltopath=&format=xhtml" dataid="6"/>
    <request method="GET" href="http://192.168.59.128/@api/deki/pages/567/tags?redirects=0" dataid="7"/>
    <request method="GET" href="http://192.168.59.128/@api/deki/files/71/=trollface.jpg" dataid="8"/>
    <request method="GET" href="http://192.168.59.128/@api/deki/files/71/properties/iscopyright" dataid="9"/>
  </requests>
  <manifest>
    <page dataid="0">
      <path>//Test</path>
      <language/>
      <contents type="application/x.deki0805+xml"/>
    </page>
    <tags dataid="1">
      <path>//Test</path>
    </tags>
    <page dataid="2">
      <path>//Test/Foo</path>
      <language/>
      <contents type="application/x.deki0805+xml"/>
    </page>
    <tags dataid="3">
      <path>//Test/Foo</path>
    </tags>
    <page dataid="4">
      <path>//Test/Foo/Pidgin</path>
      <language/>
      <contents type="application/x.deki0805+xml"/>
    </page>
    <tags dataid="5">
      <path>//Test/Foo/Pidgin</path>
    </tags>
    <page dataid="6">
      <path>//FUBAR</path>
      <language/>
      <contents type="application/x.deki0805+xml"/>
    </page>
    <tags dataid="7">
      <path>//FUBAR</path>
    </tags>
    <file dataid="8">
      <filename>trollface.jpg</filename>
      <path>//FUBAR</path>
      <contents type="image/jpg"/>
    </file>
    <property dataid="9">
      <name>iscopyright</name>
      <filename>trollface.jpg</filename>
      <path>//FUBAR</path>
      <contents type="text/plain"/>
    </property>
  </manifest>
</export>

Notes

  • Export provides the instructions and manifests to recreate a page. 

  • Was this article helpful?