Collection delete operations

There are two operations to delete collections.

The two delete operations are:
  • deleteCollections deletes one or more collections, as specified by their collection keys.
  • deleteAllCollections deletes all the collections at once, with no specification of their collection keys.

Note that there are no software pre-requirements for deleting a collection (that is, a collection can be deleted at any time). However, it is highly recommended that you first delete the records in a collection before deleting the collection itself, as described in Deleting a collection and its records.

Deleting specific collections

The deleteCollections operation allows you to delete one or more collections as specified by their collection keys. The syntax is:
<deleteCollections>
    <outerTransactionId>?</outerTransactionId>
    <language>en</language>
    <collectionKey collectionKey="?"/>
</deleteCollections>

The collectionKey element specifies the collection key of the collection to be deleted (note that collection names are case sensitive). The outerTransactionId and language attributes are optional.

The deleteCollections operation lets you delete multiple collections with the same request. To do so, use multiple collectionKey elements within the <deleteCollections> structure. Keep in mind, however, that a deleteCollections operation that deletes multiple collections is atomic, which means that either the operation is successful (i.e., all collections are successfully deleted) or the entire operation fails if at least one of the deletes fail (i.e., none of the collections is deleted).

This soapUI example deletes two collections:
<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:deleteCollections>
         <ns:language>en</ns:language>
         <ns:collectionKey collectionKey="EmpRecs"/>
         <ns:collectionKey collectionKey="ArchivedRecs"/>
      </ns:deleteCollections>
   </soapenv:Body>
</soapenv:Envelope>
If the request is successful, the numCollectionsDeleted element in the deleteCollectionsResponse message indicates the number of collections that were successfully deleted, as shown in this example:
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
   <env:Header/>
   <env:Body>
      <ns2:deleteCollectionsResponse xmlns:ns2="http://www.endeca.com/endeca-server/sconfig/3/0">
         <ns2:numCollectionsDeleted>2</ns2:numCollectionsDeleted>
      </ns2:deleteCollectionsResponse>
   </env:Body>
</env:Envelope>

In the example, two collections were deleted. If the deleteCollections operation was not successful, the numCollectionsDeleted element will have 0 (zero) as its value.

Deleting all collections at once

The deleteAllCollections operation allows you to delete all your existing collections at once, without specifying their collection keys. The syntax for this operation is:
<deleteAllCollections>
   <outerTransactionId>?</outerTransactionId>
   <language>en</language>
</deleteAllCollections>

The outerTransactionId and language attributes are optional.

If the request is successful, the numCollectionsDeleted element in the deleteAllCollectionsResponse message indicates the number of collections that were successfully deleted, as shown in this example:
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
   <env:Header/>
   <env:Body>
      <ns2:deleteAllCollectionsResponse xmlns:ns2="http://www.endeca.com/endeca-server/sconfig/3/0">
         <ns2:numCollectionsDeleted>3</ns2:numCollectionsDeleted>
      </ns2:deleteAllCollectionsResponse>
   </env:Body>
</env:Envelope>

In the example, three collections were deleted. If the deleteAllCollections operation was not successful, the numCollectionsDeleted element will have 0 (zero) as its value.

Deleting collections with entity dependencies

If you delete a collection that has an entity that depends on the collection, then the entity's isValid attribute will be set to false. In this case, you should update the configuration of the entity to remove the dependency on the deleted collection.