Documentation
UPDATE
usage
<UPDATE [throw-exception="true"]>
<element [ID="number"]>
<WHERE> <!-- updating multiple elements -->
... criterias over the elements you want to update ...
</WHERE>
<INFO> (1)
<fieldname [operator="operator"]>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>
</UPDATE>
paramètres
throw-exception : if the command fails throws a PHP exception instead of returning a XML error message
retourne
throw-exception : if the command fails throws a PHP exception instead of returning a XML error message
Sushee command destined to update objects
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
<UPDATE>
<CONTACT ID="25">
<INFO>
<FIRSTNAME>Louis</FIRSTNAME>
</INFO>
</CONTACT>
</UPDATE>
Updates the firstname of the CONTACT with the ID 25
<UPDATE>
<CONTACT ID="25">
<DEPENDENCIES>
<DEPENDENCY type="contactFamily" operation="append">
<CONTACT ID="183"/>
</DEPENDENCY>
</DEPENDENCIES>
</CONTACT>
</UPDATE>
Adds a CONTACT in the family of the CONTACT with the ID 25
<UPDATE>
<MEDIA>
<WHERE>
<INFO>
<CREATIONDATE>today-1 days</CREATIONDATE>
</INFO>
</WHERE>
<CATEGORIES operation="append">
<CATEGORY ID="25"/>
</CATEGORIES>
</MEDIA>
</UPDATE>
Updates all MEDIAS created yesterday and adds a category to these
<UPDATE>
<CONTACT ID="25">
<INFO>
<FIRSTNAME>Clara</FIRSTNAME>
</INFO>
<PROCESSORS type="preprocessor">
<PROCESSOR path="/Library/contact/processors.class.php" classname="ContactProcessor" method="execute" />
</PROCESSORS>
</CONTACT>
</UPDATE>
Updates a contact and executes a Preprocessing PHP class. It can be used to test future PROCESSORS (that are then executed on every request).