Documentation
CREATE
usage
<CREATE [throw-exception="true"]>
<element [if-exists="replace/skip/fill"]>
<INFO> (1)
<fieldname>text/number</fieldname>*
</INFO>
<DESCRIPTIONS> (2)
<DESCRIPTION [languageID="language-code"]>*
[<STATUS>published/submitted/checked/draft/unpublished/archived</STATUS>]
<TITLE>text</TITLE>
<URL>text</URL>
<HEADER>text</HEADER>
<BODY>text</BODY>
<SUMMARY>text</SUMMARY>
<SIGNATURE>text</SIGNATURE>
<BIBLIO>text</BIBLIO>
<COPYRIGHT>text</COPYRIGHT>
<CUSTOM>
<customfieldname>text</customfieldname>*
</CUSTOM>
</DESCRIPTION>
</DESCRIPTIONS>
<DEPENDENCIES> (3)
<DEPENDENCY type="text" [mode="normal/reverse"] [operation="replace/remove/append"]>*
<element [ID="number"]>*
[<INFO/><!-- only if the element doesn't exist (if no ID is set, the element is created using these informations) -->
<DESCRIPTIONS/>
<CATEGORIES/>]
[<DEPINFO>text</DEPINFO>]
[<COMMENT>text</COMMENT>]
</element>
</DEPENDENCY>
</DEPENDENCIES>
<CATEGORIES [operation="replace/remove/append"]>* (4)
<CATEGORY [ID="number"] [name="text"] [path="text"]/>*
</CATEGORIES>
[<PROCESSORS type="{preprocessor,postprocessor}">
<PROCESSOR path="string" [classname="string" method="string"]/>
...
</PROCESSORS>]
</element>
</CREATE>
paramètres
throw-exception : if the command fails throws a PHP exception instead of returning a XML error message
retourne
<MESSAGE elementID="..."/>
This NQL command creates elements (Contacts, Medias, Groups, Mailings, Category, etc).
(1) INFO : basic properties
This node contains the basic properties about the element. These are specific to each module. See the complete list about for each module in Nectil elements.
• Only one INFO node is allowed.
• If you set twice a same fieldname, the last one will be used.
(2) DESCRIPTIONS : multilingual description
This node contains a DESCRIPTION node for each language in which you want to describe the element.
• You should set a languageID attribute on every DESCRIPTION node, to define in which language the element is described. If you do not, the language in which the website is currently displayed will be used. You can find a list of the language codes here.
• If you do not set a STATUS node it will automatically be `published`.
(3) DEPENDENCIES : links between elements
The DEPENDENCIES node contains multiple DEPENDENCY nodes. Every DEPENDENCY node contains the elements (Contacts, Medias, Groups, Mailings, etc) you want to attach to the current one. The type attribute defines which dependency type should be used to attach the two elements together.
The mode attribute allows you to define whether the created element should be the parent or the child. By default, if no mode attribute is defined the new element is the parent. If mode is set to reverse, the new element is the child.
• The type attribute is mandatory.
• A dependency type concerns a specific module. No check is operated on whether you set the right type of element (e.g. MAILING instead of MEDIA), only the ID is taken in account.
(4) CATEGORIES : categorizing the element
The CATEGORIES node contains multiple CATEGORY nodes. Every CATEGORY node defines a category in which the new element should be put. You can use the ID, the name or the path of the CATEGORY.
Usage from PHP scripts
NQL is XML, you MUST use encode_to_xml() PHP function before setting a value in a field. If you do not do so, you might encounter problem using the elements concerned in your project.
exemples
<CREATE>
<CONTACT>
<INFO>
<FIRSTNAME>Boris</FIRSTNAME>
</INFO>
</CONTACT>
</CREATE>
<CREATE>
<MEDIA>
<INFO>
<MEDIATYPE>News</MEDIATYPE>
</INFO>
</MEDIA>
</CREATE>
<CREATE>
<CONTACT>
<INFO>
<FIRSTNAME>Robert</FIRSTNAME>
</INFO>
<CATEGORIES><CATEGORY ID="25"/></CATEGORIES>
</CONTACT>
</CREATE>
<CREATE>
<CONTACT>
<INFO>
<FIRSTNAME>Robert</FIRSTNAME>
</INFO>
<DEPENDENCIES>
<DEPENDENCY type="groupMember" mode="reverse"><GROUP ID="36"/></DEPENDENCY>
</DEPENDENCIES>
</CONTACT>
</CREATE>