Collection update operation

The updateCollections operation lets you update collection configurations.

You can update the configuration of a collection, with the following restrictions and behavior:
  • The collection key (the collectionKey attribute) cannot be changed. Note that you must specify the collection key in the request so that Endeca Server can identify the collection to be updated.
  • The display name (the displayName attribute) can be changed. If it is not used in the request, the previous value is kept.
  • The collection unique property key (the uniquePropertyKey attribute) cannot be changed. Note that you do not have to specify the collection unique property key in the request.
  • The description (the <description> element) can be changed. If it is not used in the request, the previous value is kept.
  • All metadata properties are first deleted by the operation, and then any that are specified (via the <property key> element) are added. This means that if you have a metadata property that you do not want to change but want to retain, you must re-specify it in the request.

Note that you cannot create new collections with this operation; you can only update existing collections.

The updateCollections operation lets you update multiple collections with the same request. To do so, use multiple collectionUpdate elements within the updateCollections structure. Keep in mind, however, that an updateCollections operation that updates multiple collections is atomic, which means that either the entire operation is successful, (that is, all collections are successfully updated), or the entire operation fails if at least one of the updates fail (that is, none of the collections is updated).

updateCollections syntax

The updateCollections syntax is:
<updateCollections>
    <outerTransactionId>?</outerTransactionId>
    <language>en</language>
   <collectionUpdate collectionKey="?" displayName="?" uniquePropertyKey="?">
      <description>?</description>
      <property key="?">?</property>
   </collectionUpdate>
</updateCollections>

The outerTransactionId and language attributes are optional.

The meanings of the collection attributes are:
collectionUpdate attribute Description
collectionKey Required. The name of the collection to be updated. Note that you cannot change the name of the collection key.
displayName Optional. If this attribute is used, the display name is changed to the specified value. If omitted, the last assignment is kept.
uniquePropertyKey Optional. The name of the collection unique property key. If this attribute is omitted or left blank, the last assignment is kept. Note that you cannot change the name of the unique property key.
description Optional. If this attribute is used, the collection's description is changed to the specified value. If omitted, the last assignment is kept.
property key Optional. You can use this attribute as follows:
  • If no property key is used, then all existing metadata properties are deleted from the collection record.
  • If a property key is used, the metadata property is added to the collection record.

updateCollections example

The following updateCollections soapUI example updates an existing collection named SalesRecs:
<soapenv:Envelope 
  xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
  xmlns:ns="http://www.endeca.com/endeca-server/sconfig/3/0">
   <soapenv:Header/>
   <soapenv:Body>
      <ns:updateCollections>
         <ns:language>en</ns:language>
         <ns:collectionUpdate collectionKey="SalesRecs" displayName="Sales Order Records">
            <ns:description>All sales order records for the company</ns:description>
            <ns:property key="Locale">US East Coast</ns:property>
         </ns:collectionUpdate>
      </ns:updateCollections>
   </soapenv:Body>
</soapenv:Envelope>

The example updates the collection's display name and description, and adds the Locale metadata property. Note that the collection's uniquePropertyKey parameter is not used for the request.

updateCollections response

The numCollectionsUpdated element in the updateCollectionsResponse message indicates the number of collections that were successfully updated, as shown in this example:
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
   <env:Header/>
   <env:Body>
      <ns2:updateCollectionsResponse xmlns:ns2="http://www.endeca.com/endeca-server/sconfig/3/0">
         <ns2:numCollectionsUpdated>2</ns2:numCollectionsUpdated>
      </ns2:updateCollectionsResponse>
   </env:Body>
</env:Envelope>

In the example, two collections were updated. If the updateCollections operation was not successful, the numCollectionsUpdated element will have 0 (zero) as its value.