Deleting an Item

In the previous sections, attributes were added and deleted from the sample item and queries were executed against the domain. This section provides examples of how to delete an item by deleting all of its attributes.

The following sample code snippets demonstrate deleting Item_03.

Java

To run the sample

  1. Open a clean copy of DeleteAttributesSample.java.

  2. 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";
    DeleteAttributes request = new DeleteAttributes().withDomainName(domainName).withItemName(itemName);
    
  3. Compile and run the sample.

    Amazon SimpleDB deletes Item_03.

To verify whether the item is deleted, see Getting the Attributes of an Item.

C#

To run the sample

  1. Open AmazonSimpleDBSamples.cs.

  2. Comment out the code you added in the previous section.

  3. Add the following to the Delete Attributes Action section:

    DeleteAttributes deleteItemAction = new DeleteAttributes().WithDomainName("MyStore").WithItemName("Item_03");
    
    DeleteAttributesSample.InvokeDeleteAttributes(service, deleteItemAction);
    
  4. Run the sample.

    Amazon SimpleDB deletes Item_03.

To verify whether the item is deleted, see Getting the Attributes of an Item.

Perl

To run the sample

  1. Open a clean copy of DeleteAttributesSample.pl.

  2. Remove any comment marks from the invokeDeleteAttributes($service, $request); line and add the following lines after the // @TODO: set request parameters here line:

    my $request = Amazon::SimpleDB::Model::DeleteAttributes->new({
    ItemName => "Item_03",
    DomainName=> "MyStore"
    });
  3. Run the sample.

    Amazon SimpleDB deletes Item_03.

To verify whether the item is deleted, see Getting the Attributes of an Item.

PHP

To run the sample

  1. Open a clean copy of DeleteAttributesSample.php.

  2. Remove any comment marks from the invokeDeleteAttributes($service, $request); line and add the following lines after the // @TODO: set request parameters here line:

    require_once ('Amazon/SimpleDB/Model/Attribute.php');
    
    $request = new Amazon_SimpleDB_Model_DeleteAttributes();
    $request->withDomainName('MyStore')->withItemName('Item_03');
    
  3. Run the sample.

    Amazon SimpleDB deletes Item_03.

To verify whether the item is deleted, see Getting the Attributes of an Item.

VB.NET

To run the sample

  1. Open AmazonSimpleDBSamples.vb.

  2. Comment out the code you added in the previous section.

  3. Add the following to the Delete Attributes Action section:

    Dim deleteItemAction As New DeleteAttributes()
    deleteItemAction.WithDomainName("MyStore").WithItemName("Item_03")
    
    DeleteAttributesSample.InvokeDeleteAttributes(service, deleteItemAction)
    
  4. Run the sample.

    Amazon SimpleDB deletes Item_03.

To verify whether the item is deleted, see Getting the Attributes of an Item.

Scratchpad

To run the sample

  1. Open the scratchpad application with a web browser.

  2. Select DeleteAttributes from the Explore API list box.

  3. Enter MyStore in the Domain Name field.

  4. Enter Item_03 in the Item Name field.

  5. Select from the following:

    • To invoke the request, click Invoke Request.

      Amazon SimpleDB deletes Item_03.

    • To view the signed URL, click Display Signed URL. Then, copy and paste the signed URL into a browser.

      Amazon SimpleDB deletes Item_03.

    • To view the string to sign, click Display String to Sign.

To verify whether the item is deleted, see Getting the Attributes of an Item.