Skip to main content
NICE CXone Expert
Expert Success Center

site/import (POST)

Overview

Generates import 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.
forceoverwrite bool? Force overwrite of destination, even if import content is older.

Return Codes

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

Message Format

Input:

<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>

Output:

<requests>
  <request method="POST" href="http://host/@api/deki/pages/{path}/contents?reltopath={path}&edittime={timestamp}&lang={lang}&title={text}" dataid="{text1}" type="{mimetype}" >
    <header name="{text}" value="{text}" />
      ...
  </request>
  <request method="PUT" href="http://host/@api/deki/pages/{path}/tags" dataid="{text2}" type="{mimetype}" >
    <header name="{text}" value="{text}" />
      ...
  </request>
  <request method="PUT" href="http://host/@api/deki/pages/{path}/properties" dataid="{text3}" type="{mimetype}" >
    <header name="{text}" value="{text}" />
      ...
  </request>
  <request method="PUT" href="http://host/@api/deki/pages/{path}/files/{filename}" dataid="{text4}" type="{mimetype}" >
    <header name="{text}" value="{text}" />
      ...
  </request>
  <request method="PUT" href="http://host/@api/deki/pages/{path}/files/{filename}/properties" dataid="{text5}" type="{mimetype}" >
    <header name="{text}" value="{text}" />
      ...
  </request>
  <request method="POST" href="http://host/@api/deki/pages/{id}/security" type="text/xml">
    <body type="xml">
      {xml body to post}
    </body>
  </request>
  <warning reason="{text}" status="401|404">
    <page dataid="{text6}">
      <title>{text}</title>
      <path>{page path using // to indicate relativity to base export page}</path>
      <language>{text}</language>
      <contents type="{mimetype}"/>
    </page>
  </warning>
  ...
</requests>

Implementation Notes

The import manifest document expected as input is the same as the manifest section from the export response. It can also be manually generated against your own content.

The requests document provides instructions for what HTTP requests must be executed to import the content from your import manifest. If a request has a dataid attribute, the data correlated to that dataid from your manifest is to be used as the request body. Request blocks with a body block will never have a dataid attribute and expect the contents of the body block to be used as the request body instead.

Curl Code Sample: Import Manifests

The following command generates import instructions according to the manifests listed in "import.xml":

Sample Code

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

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

The following demonstrates how to generate the instructions from the pages/files exported in this example.

import.xml

Content-Type: application/xml

<?xml version="1.0"?>
<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>

Sample Code

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

HTTP Response Headers

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

HTTP Response Body

Content-Type: application/xml

<requests>
  <request method="POST" href="http://192.168.59.128/@api/deki/pages/=Test/contents?reltopath=&lang=&title&edittime=99991231235959&redirects=0" dataid="0" type="application/xml; charset=utf-8"/>
  <request method="PUT" href="http://192.168.59.128/@api/deki/pages/=Test/tags?redirects=0" dataid="1" type="application/xml; charset=utf-8"/>
  <request method="POST" href="http://192.168.59.128/@api/deki/pages/=Test%252fFoo/contents?reltopath=&lang=&title&edittime=99991231235959&redirects=0" dataid="2" type="application/xml; charset=utf-8"/>
  <request method="PUT" href="http://192.168.59.128/@api/deki/pages/=Test%252fFoo/tags?redirects=0" dataid="3" type="application/xml; charset=utf-8"/>
  <request method="POST" href="http://192.168.59.128/@api/deki/pages/=Test%252fFoo%252fPidgin/contents?reltopath=&lang=&title&edittime=99991231235959&redirects=0" dataid="4" type="application/xml; charset=utf-8"/>
  <request method="PUT" href="http://192.168.59.128/@api/deki/pages/=Test%252fFoo%252fPidgin/tags?redirects=0" dataid="5" type="application/xml; charset=utf-8"/>
  <request method="POST" href="http://192.168.59.128/@api/deki/pages/=FUBAR/contents?reltopath=&lang=&title&edittime=99991231235959&redirects=0" dataid="6" type="application/xml; charset=utf-8"/>
  <request method="PUT" href="http://192.168.59.128/@api/deki/pages/=FUBAR/tags?redirects=0" dataid="7" type="application/xml; charset=utf-8"/>
  <request method="PUT" href="http://192.168.59.128/@api/deki/pages/=FUBAR/files/=trollface.jpg?redirects=0" dataid="8" type="image/jpg"/>
  <request method="PUT" href="http://192.168.59.128/@api/deki/pages/=FUBAR/files/=trollface.jpg/properties/iscopyright?abort=never&redirects=0" dataid="9" type="text/plain"/>
</requests>

 


  • Was this article helpful?