addCollectionEntry()
CustomCollectionEntry addCollectionEntry(
NewCustomCollectionEntryRequest newEntryRequest)
This method creates a new collection entry for a custom collection.
Parameters
- newEntryRequest
- Format: NewCustomCollectionEntryRequest XML
Example: Request a new custom collection entry
This example shows a NewCustomCollectionEntryRequest XML document to add a new entry to a custom collection.
<NewCustomCollectionEntryRequest xmlns="http://xml.inomial.com/smile/2.xsd">
<CollectionCode>products</CollectionCode>
<EntryCode>iphone6s</EntryCode>
<Object>
<String name="productCode">iPhone6S</String>
<String name="productDesc">Apple iPhone 6S</String>
</Object>
</NewCustomCollectionEntryRequest>
Results
This method returns a CustomCollectionEntry XML document describing the newly created custom collection entry. The entry includes a numeric key attribute that can be used to update or delete this entry at a later date.
The key is the identifier for the CustomCollectionEntry and objectId is the identifier for the custom fields within it. These values will not necessarily be the same.
Smile emits the CustomCollectionEntryAdded message when the task is complete.
Example: A returned CustomCollectionEntry XML document
This example shows a CustomCollectionEntry XML document that contains an entry key of 4997.
<CustomCollectionEntry xmlns="http://xml.inomial.com/smile/2.xsd" key="4997">
<CollectionCode>products</CollectionCode>
<EntryCode>iphone6s</EntryCode>
<Object objectId="4997" formId="1252" displayName="iphone6s - Apple iPhone 6S">
<String name="productCode">iphone6s</String>
<String name="productDesc">Apple iPhone 6S</String>
</Object>
</CustomCollectionEntry>
Faults
NoSuchItemExceptionThis fault is returned when the custom collection in CollectionCode does not exist.
NonUniqueFieldExceptionThis fault is returned when the EntryCode provided already exists.
CustomObjectExceptionThis fault is returned when one or more custom fields inside the <Object> element are missing (in the case of a mandatory field), or fail to validate against a constraint that has been set for the content of that field.
Java client syntax
java -cp build/smilewsv2-client.jar [options]
com.inomial.smile.client.v2.examples.AddCollectionEntry filename
- filename
- Purpose: Specifies the filename of the NewCustomCollectionEntryRequest XML document.