Collection create operations

The SConfig Web Service has two operations to create collections.

The putCollection operation creates a single collection, while the putCollections operation can create multiple collections at once. Both operations result in a CDR (Collection Definition Record) being created in the Dgraph.

putCollection syntax

The putCollection operation creates one collection with this syntax:
<putCollection>
   <outerTransactionId>?</outerTransactionId>
   <language>en</language>
   <collection collectionKey="?" displayName="?" uniquePropertyKey="?">
      <description>?</description>
      <property key="?">?</property>
   </collection>
</putCollection>
The meanings of the collection attributes are as follows:
Collection attribute Description
collectionKey Required. A unique identifier for the collection. The key name does not have to be in the NCName format, but must be unique among collection names. The name is case-sensitive when used with other collection operations or in queries.
displayName Optional. Defines the display name which may be used by the front-end application, such as Studio. The display name can be any arbitrary string.
uniquePropertyKey Required. Sets the standard attribute that provides the unique key values for records in the collection. Once a uniquePropertyKey is configured for a collection, it cannot be used for any other collection. In addition, this standard attribute must not already be assigned on any record.
The PDR for the standard attribute must be created with:
  • mdex-property_IsSingleAssign set to true
  • mdex-property_IsUnique set to true

Note that the this standard attribute will also serve as the primary key (record spec) for the records in this collection.

description Optional. Provides descriptive text about the collection.
property key Optional. Lets you associate a string metadata property for the collection (for example, locale information). The key name must be in the NCName format

putCollection example

The following putCollection soapUI example creates a collection named Products:
<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:putCollection>
         <ns:language>en</ns:language>
         <ns:collection collectionKey="Products" displayName="Product data" uniquePropertyKey="ProductID">
            <ns:description>product records for the region</ns:description>
            <ns:property key="Region">New England</ns:property>
         </ns:collection>
      </ns:putCollection>
   </soapenv:Body>
</soapenv:Envelope>

The existing ProductID standard attribute is used as the collection's unique property key. The collection also has an associated metadata that defines the Region property metadata as the New England region.

putCollections operation

The putCollections operation lets you create multiple collections at once, using this syntax:
<putCollections>
   <outerTransactionId>?</outerTransactionId>
   <language>en</language>
   <collection collectionKey="?" displayName="?" uniquePropertyKey="?">
      <description>?</description>
      <property key="?">?</property>
   </collection>
</putCollections>

You can supply multiple collection elements, which have the same syntax and meanings as in the single-use putCollection operation.

putCollectionResponse

The response for a successful putCollections operation looks like this example:
<putCollectionResponse xmlns="http://www.endeca.com/endeca-server/sconfig/3/0">
   <collectionAdditionInformation numCollectionsAdded="1" numCollectionsReplaced="0"/>
</putCollectionResponse>

The response shows that one new collection was added.