In the previous section, the Blue value was deleted from the Color attribute of Item_03. This section provides examples of how to delete all the values of an attribute for an item.
The following sample code snippets demonstrate deletion of all values for the Year attribute of Item_03.
To run the sample
Open a clean copy of DeleteAttributesSample.java.
Remove any comment marks from the invokeDeleteAttributes(service, request); line and add the following lines
after // @TODO: set request parameters here:
String domainName = "MyStore";
String itemName = "Item_03";
Attribute attribute = (new Attribute()).withName("Year");
DeleteAttributes request = (new DeleteAttributes()).withDomainName(domainName).withItemName(itemName).withAttribute(attribute);
Compile and run the sample.
Amazon SimpleDB deletes the Year attribute of Item_03.
To verify whether the attribute is deleted, see Getting the Attributes of an Item.
To run the sample
Open AmazonSimpleDBSamples.cs.
Comment out the code you added in the previous section.
Add the following to the Delete Attributes Action section:
Amazon.SimpleDB.Model.Attribute deleteAttribute = new Amazon.SimpleDB.Model.Attribute().WithName("Year");
DeleteAttributes deleteAttributeAction = new DeleteAttributes().WithDomainName("MyStore").WithItemName("Item_03").WithAttribute(deleteAttribute);
DeleteAttributesSample.InvokeDeleteAttributes(service, deleteAttributeAction);
Run the sample.
Amazon SimpleDB deletes the Year attribute of Item_03.
To verify whether the attribute is deleted, see Getting the Attributes of an Item.
To run the sample
Open a clean copy of DeleteAttributesSample.pl.
Remove any comment marks from the invokeDeleteAttributes($service, $request); line and add the following lines
after the // @TODO: set request line:
my $request = Amazon::SimpleDB::Model::DeleteAttributes->new({
ItemName => "Item_03",
DomainName=> "MyStore",
Attribute => [
{
Name => "Year"
}
],
});
Run the sample.
Amazon SimpleDB deletes the Year attribute of Item_03.
To verify whether the attribute is deleted, see Getting the Attributes of an Item.
To run the sample
Open a clean copy of DeleteAttributesSample.php.
Remove any comment marks from the invokeDeleteAttributes($service, $request); line and add the following lines
after the // @TODO: set request line:
require_once ('Amazon/SimpleDB/Model/Attribute.php');
$attribute = new Amazon_SimpleDB_Model_Attribute();
$attribute->setName('Year');
$request = new Amazon_SimpleDB_Model_DeleteAttributes();
$request->withDomainName('MyStore')->withItemName('Item_03')->withAttribute($attribute);
Run the sample.
Amazon SimpleDB deletes the Year attribute of Item_03.
To verify whether the attribute is deleted, see Getting the Attributes of an Item.
To run the sample
Open AmazonSimpleDBSamples.vb.
Comment out the code you added in the previous section.
Add the following to the Delete Attributes Action section:
Dim deleteAttribute As New Amazon.SimpleDB.Model.Attribute
deleteAttribute.WithName("Year")
Dim deleteAttributeAction As New DeleteAttributes()
deleteAttributeAction.WithDomainName("MyStore").WithItemName("Item_03").WithAttribute(deleteAttribute)
DeleteAttributesSample.InvokeDeleteAttributes(service, deleteAttributeAction)
Run the sample.
Amazon SimpleDB deletes the Year attribute of Item_03.
To verify whether the attribute is deleted, see Getting the Attributes of an Item.
To run the sample
Open the scratchpad application with a web browser.
Select DeleteAttributes from the Explore API list box.
Enter MyStore in the Domain Name field.
Enter Item_03 in the Item Name field.
Enter Year in the Name field.
Select from the following:
To invoke the request, click Invoke Request.
Amazon SimpleDB deletes the Year attribute of Item_03.
To view the signed URL, click Display Signed URL. Then, copy and paste the signed URL into a browser.
Amazon SimpleDB deletes the Year attribute of Item_03.
To view the string to sign, click Display String to Sign.
To verify whether the value is deleted, see Getting the Attributes of an Item.