Putting Data into a Domain

After creating a domain, you are ready to start putting data into the domain.

The PutAttributes operation creates or replaces attributes within an item. The attributes are specified using the Attribute.X.Name and Attribute.X.Value parameters. The first attribute is specified by the parameters Attribute.1.Name and Attribute.1.Value, the second attribute by the parameters Attribute.2.Name and Attribute.2.Value, and so on.

This section describes how to put the following data into the imaginary clothing/auto parts store "Off the Rack and Pinion."

The following table contains the information that you will be adding, modifying, and performing queries against.

IDCategorySubcat.NameColorSizeMakeModelYear
Item_01ClothesSweaterCathair SweaterSiameseSmall, Medium, Large   
Item_02ClothesPantsDesigner JeansPaisley Acid Wash30x32, 32x32, 32x34   
Item_03ClothesPantsSweatpantsBlue, Yellow, PinkLarge  2006, 2007
Item_04Car PartsEngineTurbos  AudiS42000, 2001, 2002
Item_05Car PartsEmissionsO2 Sensor  AudiS42000, 2001, 2002

Java

To run the sample

  1. Open a clean copy of PutAttributesSample.java.

  2. Add the following lines after // @TODO: set request parameters here:

    String domainName = "MyStore";
    
    /************************************************************************
     * Load Item_01:
     *Category = Clothes
     *Subcategory = Sweater
     *Name = Cathair Sweater
     *Color = Siamese
     *Size = Small, Medium, Large
     ***********************************************************************/
    
    String itemNameOne = "Item_01";
    java.util.List<ReplaceableAttribute> attributeListOne = new ArrayList<ReplaceableAttribute>(7);
    
    attributeListOne.add(new ReplaceableAttribute("Category", "Clothes", false));
    attributeListOne.add(new ReplaceableAttribute("Subcategory", "Sweater", false));
    attributeListOne.add(new ReplaceableAttribute("Name", "Cathair Sweater", false));
    attributeListOne.add(new ReplaceableAttribute("Color", "Siamese", false));
    attributeListOne.add(new ReplaceableAttribute("Size", "Small", false));
    attributeListOne.add(new ReplaceableAttribute("Size", "Medium", false));
    attributeListOne.add(new ReplaceableAttribute("Size", "Large", false));
    
    PutAttributes putAttributesActionOne = new PutAttributes(domainName, itemNameOne, attributeListOne);
    
    invokePutAttributes(service, putAttributesActionOne);
    
    /************************************************************************
     * Load Item_02:
     *Category = Clothes
     *Subcategory = Pants
     *Name = Designer Jeans
     *Color = Paisley Acid Wash
     *Size = 30x32, 32x32, 32x34
     ***********************************************************************/
    
    String itemNameTwo = "Item_02";
    java.util.List<ReplaceableAttribute> attributeListTwo = new ArrayList<ReplaceableAttribute>(7);
    
    attributeListTwo.add(new ReplaceableAttribute("Category", "Clothes", false));
    attributeListTwo.add(new ReplaceableAttribute("Subcategory", "Pants", false));
    attributeListTwo.add(new ReplaceableAttribute("Name", "Designer Jeans", false));
    attributeListTwo.add(new ReplaceableAttribute("Color", "Paisley Acid Wash", false));
    attributeListTwo.add(new ReplaceableAttribute("Size", "30x32", false));
    attributeListTwo.add(new ReplaceableAttribute("Size", "32x32", false));
    attributeListTwo.add(new ReplaceableAttribute("Size", "32x34", false));
    
    PutAttributes putAttributesActionTwo = new PutAttributes(domainName, itemNameTwo, attributeListTwo);
    
    invokePutAttributes(service, putAttributesActionTwo);
    
    /************************************************************************
     * Load Item_03:
     *Category = Clothes
     *Subcategory = Pants
     *Name = Sweatpants
     *Color = Blue, Yellow, Pink
     *Size = Large
     *Year = 2006, 2007
     ***********************************************************************/
    
    String itemNameThree = "Item_03";
    java.util.List<ReplaceableAttribute> attributeListThree = new ArrayList<ReplaceableAttribute>(9);
    
    attributeListThree.add(new ReplaceableAttribute("Category", "Clothes", false));
    attributeListThree.add(new ReplaceableAttribute("Subcategory", "Pants", false));
    attributeListThree.add(new ReplaceableAttribute("Name", "Sweatpants", false));
    attributeListThree.add(new ReplaceableAttribute("Color", "Blue", false));
    attributeListThree.add(new ReplaceableAttribute("Color", "Yellow", false));
    attributeListThree.add(new ReplaceableAttribute("Color", "Pink", false));
    attributeListThree.add(new ReplaceableAttribute("Size", "Large", false));
    attributeListThree.add(new ReplaceableAttribute("Year", "2006", false));
    attributeListThree.add(new ReplaceableAttribute("Year", "2007", false));
    
    PutAttributes putAttributesActionThree = new PutAttributes(domainName, itemNameThree, attributeListThree);
    
    invokePutAttributes(service, putAttributesActionThree);
    
    /************************************************************************
     * Load Item_04:
     *Category = Car Parts
     *Subcategory = Engine
     *Name = Turbos
     *Make = Audi
     *Model = S4
     *Year = 2000, 2001, 2002
     ***********************************************************************/
    
    String itemNameFour = "Item_04";
    java.util.List<ReplaceableAttribute> attributeListFour = new ArrayList<ReplaceableAttribute>(8);
    
    attributeListFour.add(new ReplaceableAttribute("Category", "Car Parts", false));
    attributeListFour.add(new ReplaceableAttribute("Subcategory", "Engine", false));
    attributeListFour.add(new ReplaceableAttribute("Name", "Turbos", false));
    attributeListFour.add(new ReplaceableAttribute("Make", "Audi", false));
    attributeListFour.add(new ReplaceableAttribute("Model", "S4", false));
    attributeListFour.add(new ReplaceableAttribute("Year", "2000", false));
    attributeListFour.add(new ReplaceableAttribute("Year", "2001", false));
    attributeListFour.add(new ReplaceableAttribute("Year", "2002", false));
    
    PutAttributes putAttributesActionFour = new PutAttributes(domainName, itemNameFour, attributeListFour);
    
    invokePutAttributes(service, putAttributesActionFour);
    
    /************************************************************************
     * Load Item_05:
     *Category = Car Parts
     *Subcategory = Emissions
     *Name = O2 Sensor
     *Make = Audi
     *Model = S4
     *Year = 2000, 2001, 2002
     ***********************************************************************/
    
    String itemNameFive = "Item_05";
    java.util.List<ReplaceableAttribute> attributeListFive = new ArrayList<ReplaceableAttribute>(8);
    
    attributeListFive.add(new ReplaceableAttribute("Category", "Car Parts", false));
    attributeListFive.add(new ReplaceableAttribute("Subcategory", "Emissions", false));
    attributeListFive.add(new ReplaceableAttribute("Name", "O2 Sensor", false));
    attributeListFive.add(new ReplaceableAttribute("Make", "Audi", false));
    attributeListFive.add(new ReplaceableAttribute("Model", "S4", false));
    attributeListFive.add(new ReplaceableAttribute("Year", "2000", false));
    attributeListFive.add(new ReplaceableAttribute("Year", "2001", false));
    attributeListFive.add(new ReplaceableAttribute("Year", "2002", false));
    
    PutAttributes putAttributesActionFive = new PutAttributes(domainName, itemNameFive, attributeListFive);
    
    invokePutAttributes(service, putAttributesActionFive);
    }
    
  3. Compile and run the sample.

    The name-value pairs are stored in Amazon SimpleDB.

C#

To run the sample

  1. Open AmazonSimpleDBSamples.cs.

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

  3. Replace the Put Attributes Action section with the following:

    String domainName = "MyStore";
    /************************************************************************
     * Load Item_01:
     *        Category = Clothes
     *        Subcategory = Sweater
     *        Name = Cathair Sweater
     *        Color = Siamese
     *        Size = Small, Medium, Large
     ***********************************************************************/
    String itemNameOne = "Item_01";
    List<ReplaceableAttribute> attributeListOne = new List<ReplaceableAttribute>(7);
    
    attributeListOne.Add(new ReplaceableAttribute().WithName("Category").WithValue("Clothes"));
    attributeListOne.Add(new ReplaceableAttribute().WithName("Subcategory").WithValue("Sweater"));
    attributeListOne.Add(new ReplaceableAttribute().WithName("Name").WithValue("Cathair Sweater"));
    attributeListOne.Add(new ReplaceableAttribute().WithName("Color").WithValue("Siamese"));
    attributeListOne.Add(new ReplaceableAttribute().WithName("Size").WithValue("Small"));
    attributeListOne.Add(new ReplaceableAttribute().WithName("Size").WithValue("Medium"));
    attributeListOne.Add(new ReplaceableAttribute().WithName("Size").WithValue("Large"));
    
    PutAttributes putAttributesActionOne = new PutAttributes().WithDomainName(domainName).WithItemName(itemNameOne);
    putAttributesActionOne.Attribute = attributeListOne;
    
    PutAttributesSample.InvokePutAttributes(service, putAttributesActionOne);
    
    /************************************************************************
     * Load Item_02:
     *        Category = Clothes
     *        Subcategory = Pants
     *        Name = Designer Jeans
     *        Color = Paisley Acid Wash
     *        Size = 30x32, 32x32, 32x34
     ***********************************************************************/
    
    String itemNameTwo = "Item_02";
    List<ReplaceableAttribute> attributeListTwo = new List<ReplaceableAttribute>(7);
    
    attributeListTwo.Add(new ReplaceableAttribute().WithName("Category").WithValue("Clothes"));
    attributeListTwo.Add(new ReplaceableAttribute().WithName("Subcategory").WithValue("Pants"));
    attributeListTwo.Add(new ReplaceableAttribute().WithName("Name").WithValue("Designer Jeans"));
    attributeListTwo.Add(new ReplaceableAttribute().WithName("Color").WithValue("Paisley Acid Wash"));
    attributeListTwo.Add(new ReplaceableAttribute().WithName("Size").WithValue("30x32"));
    attributeListTwo.Add(new ReplaceableAttribute().WithName("Size").WithValue("32x32"));
    attributeListTwo.Add(new ReplaceableAttribute().WithName("Size").WithValue("32x34"));
    
    PutAttributes putAttributesActionTwo = new PutAttributes().WithDomainName(domainName).WithItemName(itemNameTwo);
    putAttributesActionTwo.Attribute = attributeListTwo;
    
    PutAttributesSample.InvokePutAttributes(service, putAttributesActionTwo);
    
    /************************************************************************
     * Load Item_03:
     *        Category = Clothes
     *        Subcategory = Pants
     *        Name = Sweatpants
     *        Color = Blue, Yellow, Pink
     *        Size = Large
     *        Year = 2006, 2007
     ***********************************************************************/
    
    String itemNameThree = "Item_03";
    List<ReplaceableAttribute> attributeListThree = new List<ReplaceableAttribute>(9);
    
    attributeListThree.Add(new ReplaceableAttribute().WithName("Category").WithValue("Clothes"));
    attributeListThree.Add(new ReplaceableAttribute().WithName("Subcategory").WithValue("Pants"));
    attributeListThree.Add(new ReplaceableAttribute().WithName("Name").WithValue("Sweatpants"));
    attributeListThree.Add(new ReplaceableAttribute().WithName("Color").WithValue("Blue"));
    attributeListThree.Add(new ReplaceableAttribute().WithName("Color").WithValue("Yellow"));
    attributeListThree.Add(new ReplaceableAttribute().WithName("Color").WithValue("Pink"));
    attributeListThree.Add(new ReplaceableAttribute().WithName("Size").WithValue("Large"));
    attributeListThree.Add(new ReplaceableAttribute().WithName("Year").WithValue("2006"));
    attributeListThree.Add(new ReplaceableAttribute().WithName("Year").WithValue("2007"));
    
    PutAttributes putAttributesActionThree = new PutAttributes().WithDomainName(domainName).WithItemName(itemNameThree);
    putAttributesActionThree.Attribute = attributeListThree;
    
    PutAttributesSample.InvokePutAttributes(service, putAttributesActionThree);
    
    /************************************************************************
     * Load Item_04:
     *        Category = Car Parts
     *        Subcategory = Engine
     *        Name = Turbos
     *        Make = Audi
     *        Model = S4
     *        Year = 2000, 2001, 2002
     ***********************************************************************/
    
    String itemNameFour = "Item_04";
    List<ReplaceableAttribute> attributeListFour = new List<ReplaceableAttribute>(8);
    
    attributeListFour.Add(new ReplaceableAttribute().WithName("Category").WithValue("Car Parts"));
    attributeListFour.Add(new ReplaceableAttribute().WithName("Subcategory").WithValue("Engine"));
    attributeListFour.Add(new ReplaceableAttribute().WithName("Name").WithValue("Turbos"));
    attributeListFour.Add(new ReplaceableAttribute().WithName("Make").WithValue("Audi"));
    attributeListFour.Add(new ReplaceableAttribute().WithName("Model").WithValue("S4"));
    attributeListFour.Add(new ReplaceableAttribute().WithName("Year").WithValue("2000"));
    attributeListFour.Add(new ReplaceableAttribute().WithName("Year").WithValue("2001"));
    attributeListFour.Add(new ReplaceableAttribute().WithName("Year").WithValue("2002"));
    
    PutAttributes putAttributesActionFour = new PutAttributes().WithDomainName(domainName).WithItemName(itemNameFour);
    putAttributesActionFour.Attribute = attributeListFour;
    
    PutAttributesSample.InvokePutAttributes(service, putAttributesActionFour);
    
    /************************************************************************
     * Load Item_05:
     *        Category = Car Parts
     *        Subcategory = Emissions
     *        Name = O2 Sensor
     *        Make = Audi
     *        Model = S4
     *        Year = 2000, 2001, 2002
     ***********************************************************************/
    
    String itemNameFive = "Item_05";
    List<ReplaceableAttribute> attributeListFive = new List<ReplaceableAttribute>(8);
    
    attributeListFive.Add(new ReplaceableAttribute().WithName("Category").WithValue("Car Parts"));
    attributeListFive.Add(new ReplaceableAttribute().WithName("Subcategory").WithValue("Emissions"));
    attributeListFive.Add(new ReplaceableAttribute().WithName("Name").WithValue("O2 Sensor"));
    attributeListFive.Add(new ReplaceableAttribute().WithName("Make").WithValue("Audi"));
    attributeListFive.Add(new ReplaceableAttribute().WithName("Model").WithValue("S4"));
    attributeListFive.Add(new ReplaceableAttribute().WithName("Year").WithValue("2000"));
    attributeListFive.Add(new ReplaceableAttribute().WithName("Year").WithValue("2001"));
    attributeListFive.Add(new ReplaceableAttribute().WithName("Year").WithValue("2002"));
    
    PutAttributes putAttributesActionFive = new PutAttributes().WithDomainName(domainName).WithItemName(itemNameFive);
    putAttributesActionFive.Attribute = attributeListFive;
    
    PutAttributesSample.InvokePutAttributes(service, putAttributesActionFive);
    
  4. Run the sample.

    The name-value pairs are stored in Amazon SimpleDB.

Perl

To run the sample

  1. Open a clean copy of PutAttributesSample.pl.

  2. Add the following lines after the @TODO: set request line:

    #************************************************************************
     # Load Item_01:
     #        Category = Clothes
     #        Subcategory = Sweater
     #        Name = Cathair Sweater
     #        Color = Siamese
     #        Size = Small, Medium, Large
     #***********************************************************************/
    
    my $request = Amazon::SimpleDB::Model::PutAttributes->new({
    				 ItemName => "Item_01",
    				 DomainName=> "MyStore",
    				 Attribute => [
    						 {
    										 Name => "Category",
    										 Value => "Clothes"
    						 },
    						 {
    										 Name => "Subcategory",
    										 Value => "Sweater"
    						 },
    						 {
    										 Name => "Name",
    										 Value => "Cathair Sweater"
    						 },
    						 {
    										 Name => "Color",
    										 Value => "Siamese"
    						 },
    						 {
    										 Name => "Size",
    										 Value => "Small"
    						 },
    						 {
    										 Name => "Size",
    										 Value => "Medium"
    						 },
    						 {
    										 Name => "Size",
    										 Value => "Large"
    						 }
    				 ],
    });
    
     invokePutAttributes($service, $request);
    
     #************************************************************************
     # Load Item_02:
     #        Category = Clothes
     #        Subcategory = Pants
     #        Name = Designer Jeans
     #        Color = Paisley Acid Wash
     #        Size = 30x32, 32x32, 32x34
     #***********************************************************************/
    
    $request = Amazon::SimpleDB::Model::PutAttributes->new({
    				 ItemName => "Item_02",
    				 DomainName=> "MyStore",
    				 Attribute => [
    						 {
    										 Name => "Category",
    										 Value => "Clothes"
    						 },
    						 {
    										 Name => "Subcategory",
    										 Value => "Pants"
    						 },
    						 {
    										 Name => "Name",
    										 Value => "Designer Jeans"
    						 },
    						 {
    										 Name => "Color",
    										 Value => "Paisley Acid Wash"
    						 },
    						 {
    										 Name => "Size",
    										 Value => "30x32"
    						 },
    						 {
    										 Name => "Size",
    										 Value => "32x32"
    						 },
    						 {
    										 Name => "Size",
    										 Value => "32x34"
    						 }
    				 ],
    });
    
     invokePutAttributes($service, $request);
    
     #************************************************************************
     # Load Item_03:
     #        Category = Clothes
     #        Subcategory = Pants
     #        Name = Sweatpants
     #        Color = Blue, Yellow, Pink
     #        Size = Large
     #        Year = 2006, 2007
     #***********************************************************************/
    
    $request = Amazon::SimpleDB::Model::PutAttributes->new({
    				 ItemName => "Item_03",
    				 DomainName=> "MyStore",
    				 Attribute => [
    						 {
    										 Name => "Category",
    										 Value => "Clothes"
    						 },
    						 {
    										 Name => "Subcategory",
    										 Value => "Pants"
    						 },
    						 {
    										 Name => "Name",
    										 Value => "Sweatpants"
    						 },
    						 {
    										 Name => "Color",
    										 Value => "Blue"
    						 },
    						 {
    										 Name => "Color",
    										 Value => "Yellow"
    						 },
    						 {
    										 Name => "Color",
    										 Value => "Pink"
    						 },
    						 {
    										 Name => "Size",
    										 Value => "Large"
    						 },
    						 {
    										 Name => "Year",
    										 Value => "2006"
    						 },
    						 {
    										 Name => "Year",
    										 Value => "2007"
    						 }
    				 ],
    });
     invokePutAttributes($service, $request);
    
     #************************************************************************
     # Load Item_04:
     #        Category = Car Parts
     #        Subcategory = Engine
     #        Name = Turbos
     #        Make = Audi
     #        Model = S4
     #        Year = 2000, 2001, 2002
     #***********************************************************************/
    
    $request = Amazon::SimpleDB::Model::PutAttributes->new({
    				 ItemName => "Item_04",
    				 DomainName=> "MyStore",
    				 Attribute => [
    						 {
    										 Name => "Category",
    										 Value => "Car Parts"
    						 },
    						 {
    										 Name => "Subcategory",
    										 Value => "Engine"
    						 },
    						 {
    										 Name => "Name",
    										 Value => "Turbos"
    						 },
    						 {
    										 Name => "Make",
    										 Value => "Audi"
    						 },
    						 {
    										 Name => "Model",
    										 Value => "S4"
    						 },
    						 {
    										 Name => "Year",
    										 Value => "2000"
    						 },
    						 {
    										 Name => "Year",
    										 Value => "2001"
    						 },
    						 {
    										 Name => "Year",
    										 Value => "2002"
    						 }
    				 ],
    });
     invokePutAttributes($service, $request);
    
     #************************************************************************
     # Load Item_05:
     #        Category = Car Parts
     #        Subcategory = Emissions
     #        Name = O2 Sensor
     #        Make = Audi
     #        Model = S4
     #        Year = 2000, 2001, 2002
     #***********************************************************************/
    
    $request = Amazon::SimpleDB::Model::PutAttributes->new({
    				 ItemName => "Item_05",
    				 DomainName=> "MyStore",
    				 Attribute => [
    						 {
    										 Name => "Category",
    										 Value => "Car Parts"
    						 },
    						 {
    										 Name => "Subcategory",
    										 Value => "Emissions"
    						 },
    						 {
    										 Name => "Name",
    										 Value => "O2 Sensor"
    						 },
    						 {
    										 Name => "Make",
    										 Value => "Audi"
    						 },
    						 {
    										 Name => "Model",
    										 Value => "S4"
    						 },
    						 {
    										 Name => "Year",
    										 Value => "2000"
    						 },
    						 {
    										 Name => "Year",
    										 Value => "2001"
    						 },
    						 {
    										 Name => "Year",
    										 Value => "2002"
    						 }
    				 ],
    });
     invokePutAttributes($service, $request);
    
  3. Run the sample.

    The name-value pairs are stored in Amazon SimpleDB.

PHP

To run the sample

  1. Open a clean copy of PutAttributesSample.php.

  2. Add the following lines after the @TODO: set request line:

    require_once ('Amazon/SimpleDB/Model/ReplaceableAttribute.php');
    $domainName = 'MyStore';
    /************************************************************************
    * Load Item_01:
    * Category = Clothes
    * Subcategory = Sweater
    * Name = Cathair Sweater
    * Color = Siamese
    * Size = Small, Medium, Large
    ***********************************************************************/
    $itemName = 'Item_01';
    $attribute1 = new Amazon_SimpleDB_Model_ReplaceableAttribute();
    $attribute1->withName('Category')->withValue('Clothes');
    $attribute2 = new Amazon_SimpleDB_Model_ReplaceableAttribute();
    $attribute2->withName('Subcategory')->withValue('Sweater');
    $attribute3 = new Amazon_SimpleDB_Model_ReplaceableAttribute();
    $attribute3->withName('Name')->withValue('Cathair Sweater');
    $attribute4 = new Amazon_SimpleDB_Model_ReplaceableAttribute();
    $attribute4->withName('Color')->withValue('Siamese');
    $attribute5 = new Amazon_SimpleDB_Model_ReplaceableAttribute();
    $attribute5->withName('Size')->withValue('Small');
    $attribute6 = new Amazon_SimpleDB_Model_ReplaceableAttribute();
    $attribute6->withName('Size')->withValue('Medium');
    $attribute7 = new Amazon_SimpleDB_Model_ReplaceableAttribute();
    $attribute7->withName('Size')->withValue('Large');
    $attributeList = array($attribute1, $attribute2, $attribute3, $attribute4,
    $attribute5, $attribute6, $attribute7);
    $request = new Amazon_SimpleDB_Model_PutAttributes();
    $request->withDomainName($domainName)->withItemName($itemName)->setAttribute
    ($attributeList);
    invokePutAttributes($service, $request);
    /************************************************************************
    * Load Item_02:
    * Category = Clothes
    * Subcategory = Pants
    * Name = Designer Jeans
    * Color = Paisley Acid Wash
    * Size = 30x32, 32x32, 32x34
    ***********************************************************************/
    $itemName = 'Item_02';
    $attribute1 = new Amazon_SimpleDB_Model_ReplaceableAttribute();
    $attribute1->withName('Category')->withValue('Clothes');
    $attribute2 = new Amazon_SimpleDB_Model_ReplaceableAttribute();
    $attribute2->withName('Subcategory')->withValue('Pants');
    $attribute3 = new Amazon_SimpleDB_Model_ReplaceableAttribute();
    $attribute3->withName('Name')->withValue('Designer Jeans');
    $attribute4 = new Amazon_SimpleDB_Model_ReplaceableAttribute();
    $attribute4->withName('Color')->withValue('Paisley Acid Wash');
    $attribute5 = new Amazon_SimpleDB_Model_ReplaceableAttribute();
    $attribute5->withName('Size')->withValue('30x32');
    $attribute6 = new Amazon_SimpleDB_Model_ReplaceableAttribute();
    $attribute6->withName('Size')->withValue('32x32');
    $attribute7 = new Amazon_SimpleDB_Model_ReplaceableAttribute();
    $attribute7->withName('Size')->withValue('32x34');
    $attributeList = array($attribute1, $attribute2, $attribute3, $attribute4,
    $attribute5, $attribute6, $attribute7);
    $request = new Amazon_SimpleDB_Model_PutAttributes();
    $request->withDomainName($domainName)->withItemName($itemName)->setAttribute
    ($attributeList);
    invokePutAttributes($service, $request);
    /************************************************************************
    * Load Item_03:
    * Category = Clothes
    * Subcategory = Pants
    * Name = Sweatpants
    * Color = Blue, Yellow, Pink
    * Size = Large
    * Year = 2006, 2007
    ***********************************************************************/
    $itemName = 'Item_03';
    $attribute1 = new Amazon_SimpleDB_Model_ReplaceableAttribute();
    $attribute1->withName('Category')->withValue('Clothes');
    $attribute2 = new Amazon_SimpleDB_Model_ReplaceableAttribute();
    $attribute2->withName('Subcategory')->withValue('Pants');
    $attribute3 = new Amazon_SimpleDB_Model_ReplaceableAttribute();
    $attribute3->withName('Name')->withValue('Sweatpants');
    $attribute4 = new Amazon_SimpleDB_Model_ReplaceableAttribute();
    $attribute4->withName('Color')->withValue('Blue');
    $attribute5 = new Amazon_SimpleDB_Model_ReplaceableAttribute();
    $attribute5->withName('Color')->withValue('Yellow');
    $attribute6 = new Amazon_SimpleDB_Model_ReplaceableAttribute();
    $attribute6->withName('Color')->withValue('Pink');
    $attribute7 = new Amazon_SimpleDB_Model_ReplaceableAttribute();
    $attribute7->withName('Size')->withValue('Large');
    $attribute8 = new Amazon_SimpleDB_Model_ReplaceableAttribute();
    $attribute8->withName('Year')->withValue('2006');
    $attribute9 = new Amazon_SimpleDB_Model_ReplaceableAttribute();
    $attribute9->withName('Year')->withValue('2007');
    $attributeList = array($attribute1, $attribute2, $attribute3, $attribute4,
    $attribute5, $attribute6, $attribute7, $attribute8, $attribute9);
    $request = new Amazon_SimpleDB_Model_PutAttributes();
    $request->withDomainName($domainName)->withItemName($itemName)->setAttribute
    ($attributeList);
    invokePutAttributes($service, $request);
    /************************************************************************
    * Load Item_04:
    * Category = Car Parts
    * Subcategory = Engine
    * Name = Turbos
    * Make = Audi
    * Model = S4
    * Year = 2000, 2001, 2002
    ***********************************************************************/
    $itemName = 'Item_04';
    $attribute1 = new Amazon_SimpleDB_Model_ReplaceableAttribute();
    $attribute1->withName('Category')->withValue('Car Parts');
    $attribute2 = new Amazon_SimpleDB_Model_ReplaceableAttribute();
    $attribute2->withName('Subcategory')->withValue('Engine');
    $attribute3 = new Amazon_SimpleDB_Model_ReplaceableAttribute();
    $attribute3->withName('Name')->withValue('Turbos');
    $attribute4 = new Amazon_SimpleDB_Model_ReplaceableAttribute();
    $attribute4->withName('Make')->withValue('Audi');
    $attribute5 = new Amazon_SimpleDB_Model_ReplaceableAttribute();
    $attribute5->withName('Model')->withValue('Yellow');
    $attribute6 = new Amazon_SimpleDB_Model_ReplaceableAttribute();
    $attribute6->withName('Year')->withValue('2000');
    $attribute7 = new Amazon_SimpleDB_Model_ReplaceableAttribute();
    $attribute7->withName('Year')->withValue('2001');
    $attribute8 = new Amazon_SimpleDB_Model_ReplaceableAttribute();
    $attribute8->withName('Year')->withValue('2002');
    $attributeList = array($attribute1, $attribute2, $attribute3, $attribute4,
    $attribute5, $attribute6, $attribute7, $attribute8);
    $request = new Amazon_SimpleDB_Model_PutAttributes();
    $request->withDomainName($domainName)->withItemName($itemName)->setAttribute
    ($attributeList);
    invokePutAttributes($service, $request);
    /************************************************************************
    * Load Item_05:
    * Category = Car Parts
    * Subcategory = Emissions
    * Name = O2 Sensor
    * Make = Audi
    * Model = S4
    * Year = 2000, 2001, 2002
    ***********************************************************************/
    $itemName = 'Item_05';
    $attribute1 = new Amazon_SimpleDB_Model_ReplaceableAttribute();
    $attribute1->withName('Category')->withValue('Car Parts');
    $attribute2 = new Amazon_SimpleDB_Model_ReplaceableAttribute();
    $attribute2->withName('Subcategory')->withValue('Emissions');
    $attribute3 = new Amazon_SimpleDB_Model_ReplaceableAttribute();
    $attribute3->withName('Name')->withValue('O2 Sensor');
    $attribute4 = new Amazon_SimpleDB_Model_ReplaceableAttribute();
    $attribute4->withName('Make')->withValue('Audi');
    $attribute5 = new Amazon_SimpleDB_Model_ReplaceableAttribute();
    $attribute5->withName('Model')->withValue('Yellow');
    $attribute6 = new Amazon_SimpleDB_Model_ReplaceableAttribute();
    $attribute6->withName('Year')->withValue('2000');
    $attribute7 = new Amazon_SimpleDB_Model_ReplaceableAttribute();
    $attribute7->withName('Year')->withValue('2001');
    $attribute8 = new Amazon_SimpleDB_Model_ReplaceableAttribute();
    $attribute8->withName('Year')->withValue('2002');
    $attributeList = array($attribute1, $attribute2, $attribute3, $attribute4,
    $attribute5, $attribute6, $attribute7, $attribute8);
    $request = new Amazon_SimpleDB_Model_PutAttributes();
    $request->withDomainName($domainName)->withItemName($itemName)->setAttribute
    ($attributeList);
    
  3. Run the sample.

    The name-value pairs are stored in Amazon SimpleDB.

VB.NET

To run the sample

  1. Open AmazonSimpleDBSamples.vb.

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

  3. Replace the Put Attributes Action section with the following:

    Dim domainName As String
    domainName = "MyStore"
    '-------------------------------------------------------------------
    ' Load Item_01:
    '        Category = Clothes
    '        Subcategory = Sweater
    '        Name = Cathair Sweater
    '        Color = Siamese
    '        Size = Small, Medium, Large
    '-------------------------------------------------------------------
    Dim itemNameOne As String
    itemNameOne = "Item_01"
    
    Dim attributeItemOne_One As New ReplaceableAttribute
    attributeItemOne_One.WithName("Category").WithValue("Clothes")
    Dim attributeItemOne_Two As New ReplaceableAttribute
    attributeItemOne_Two.WithName("Subcategory").WithValue("Sweater")
    Dim attributeItemOne_Three As New ReplaceableAttribute
    attributeItemOne_Three.WithName("Name").WithValue("Cathair Sweater")
    Dim attributeItemOne_Four As New ReplaceableAttribute
    attributeItemOne_Four.WithName("Color").WithValue("Siamese")
    Dim attributeItemOne_Five As New ReplaceableAttribute
    attributeItemOne_Five.WithName("Size").WithValue("Small")
    Dim attributeItemOne_Six As New ReplaceableAttribute
    attributeItemOne_Six.WithName("Size").WithValue("Medium")
    Dim attributeItemOne_Seven As New ReplaceableAttribute
    attributeItemOne_Seven.WithName("Size").WithValue("Large")
    
    Dim putAttributesActionOne As New PutAttributes()
    putAttributesActionOne.WithDomainName(domainName).WithItemName(itemNameOne)
    putAttributesActionOne.WithAttribute(attributeItemOne_One)
    putAttributesActionOne.WithAttribute(attributeItemOne_Two)
    putAttributesActionOne.WithAttribute(attributeItemOne_Three)
    putAttributesActionOne.WithAttribute(attributeItemOne_Four)
    putAttributesActionOne.WithAttribute(attributeItemOne_Five)
    putAttributesActionOne.WithAttribute(attributeItemOne_Six)
    putAttributesActionOne.WithAttribute(attributeItemOne_Seven)
    
    PutAttributesSample.InvokePutAttributes(service, putAttributesActionOne)
    
    '-------------------------------------------------------------------
    ' Load Item_02:
    '        Category = Clothes
    '        Subcategory = Pants
    '        Name = Designer Jeans
    '        Color = Paisley Acid Wash
    '        Size = 30x32, 32x32, 32x34
    '-------------------------------------------------------------------
    Dim itemNameTwo As String
    itemNameTwo = "Item_02"
    
    Dim attributeItemTwo_One As New ReplaceableAttribute
    attributeItemTwo_One.WithName("Category").WithValue("Clothes")
    Dim attributeItemTwo_Two As New ReplaceableAttribute
    attributeItemTwo_Two.WithName("Subcategory").WithValue("Pants")
    Dim attributeItemTwo_Three As New ReplaceableAttribute
    attributeItemTwo_Three.WithName("Name").WithValue("Designer Jeans")
    Dim attributeItemTwo_Four As New ReplaceableAttribute
    attributeItemTwo_Four.WithName("Color").WithValue("Paisley Acid Wash")
    Dim attributeItemTwo_Five As New ReplaceableAttribute
    attributeItemTwo_Five.WithName("Size").WithValue("30x32")
    Dim attributeItemTwo_Six As New ReplaceableAttribute
    attributeItemTwo_Six.WithName("Size").WithValue("32x32")
    Dim attributeItemTwo_Seven As New ReplaceableAttribute
    attributeItemTwo_Seven.WithName("Size").WithValue("32x34")
    
    Dim putAttributesActionTwo As New PutAttributes()
    putAttributesActionTwo.WithDomainName(domainName).WithItemName(itemNameTwo)
    putAttributesActionTwo.WithAttribute(attributeItemTwo_One)
    putAttributesActionTwo.WithAttribute(attributeItemTwo_Two)
    putAttributesActionTwo.WithAttribute(attributeItemTwo_Three)
    putAttributesActionTwo.WithAttribute(attributeItemTwo_Four)
    putAttributesActionTwo.WithAttribute(attributeItemTwo_Five)
    putAttributesActionTwo.WithAttribute(attributeItemTwo_Six)
    putAttributesActionTwo.WithAttribute(attributeItemTwo_Seven)
    
    PutAttributesSample.InvokePutAttributes(service, putAttributesActionTwo)
    
    '-------------------------------------------------------------------
    ' Load Item_03:
    '        Category = Clothes
    '        Subcategory = Pants
    '        Name = Sweatpants
    '        Color = Blue, Yellow, Pink
    '        Size = Large
    '        Year = 2006, 2007
    '-------------------------------------------------------------------
    Dim itemNameThree As String
    itemNameThree = "Item_03"
    
    Dim attributeItemThree_One As New ReplaceableAttribute
    attributeItemThree_One.WithName("Category").WithValue("Clothes")
    Dim attributeItemThree_Two As New ReplaceableAttribute
    attributeItemThree_Two.WithName("Subcategory").WithValue("Pants")
    Dim attributeItemThree_Three As New ReplaceableAttribute
    attributeItemThree_Three.WithName("Name").WithValue("Sweatpants")
    Dim attributeItemThree_Four As New ReplaceableAttribute
    attributeItemThree_Four.WithName("Color").WithValue("Blue")
    Dim attributeItemThree_Five As New ReplaceableAttribute
    attributeItemThree_Five.WithName("Color").WithValue("Yellow")
    Dim attributeItemThree_Six As New ReplaceableAttribute
    attributeItemThree_Six.WithName("Color").WithValue("Pink")
    Dim attributeItemThree_Seven As New ReplaceableAttribute
    attributeItemThree_Seven.WithName("Size").WithValue("Large")
    Dim attributeItemThree_Eight As New ReplaceableAttribute
    attributeItemThree_Eight.WithName("Year").WithValue("2006")
    Dim attributeItemThree_Nine As New ReplaceableAttribute
    attributeItemThree_Nine.WithName("Year").WithValue("2007")
    
    Dim putAttributesActionThree As New PutAttributes()
    putAttributesActionThree.WithDomainName(domainName).WithItemName(itemNameThree)
    putAttributesActionThree.WithAttribute(attributeItemThree_One)
    putAttributesActionThree.WithAttribute(attributeItemThree_Two)
    putAttributesActionThree.WithAttribute(attributeItemThree_Three)
    putAttributesActionThree.WithAttribute(attributeItemThree_Four)
    putAttributesActionThree.WithAttribute(attributeItemThree_Five)
    putAttributesActionThree.WithAttribute(attributeItemThree_Six)
    putAttributesActionThree.WithAttribute(attributeItemThree_Seven)
    putAttributesActionThree.WithAttribute(attributeItemThree_Eight)
    putAttributesActionThree.WithAttribute(attributeItemThree_Nine)
    
    PutAttributesSample.InvokePutAttributes(service, putAttributesActionThree)
    
    '-------------------------------------------------------------------
    ' Load Item_04:
    '        Category = Car Parts
    '        Subcategory = Engine
    '        Name = Turbos
    '        Make = Audi
    '        Model = S4
    '        Year = 2000, 2001, 2002
    '-------------------------------------------------------------------
    Dim itemNameFour As String
    itemNameFour = "Item_04"
    
    Dim attributeItemFour_One As New ReplaceableAttribute
    attributeItemFour_One.WithName("Category").WithValue("Car Parts")
    Dim attributeItemFour_Two As New ReplaceableAttribute
    attributeItemFour_Two.WithName("Subcategory").WithValue("Engine")
    Dim attributeItemFour_Three As New ReplaceableAttribute
    attributeItemFour_Three.WithName("Name").WithValue("Turbos")
    Dim attributeItemFour_Four As New ReplaceableAttribute
    attributeItemFour_Four.WithName("Make").WithValue("Audi")
    Dim attributeItemFour_Five As New ReplaceableAttribute
    attributeItemFour_Five.WithName("Model").WithValue("S4")
    Dim attributeItemFour_Six As New ReplaceableAttribute
    attributeItemFour_Six.WithName("Year").WithValue("2000")
    Dim attributeItemFour_Seven As New ReplaceableAttribute
    attributeItemFour_Seven.WithName("Year").WithValue("2001")
    Dim attributeItemFour_Eight As New ReplaceableAttribute
    attributeItemFour_Eight.WithName("Year").WithValue("2002")
    
    Dim putAttributesActionFour As New PutAttributes()
    putAttributesActionFour.WithDomainName(domainName).WithItemName(itemNameFour)
    putAttributesActionFour.WithAttribute(attributeItemFour_One)
    putAttributesActionFour.WithAttribute(attributeItemFour_Two)
    putAttributesActionFour.WithAttribute(attributeItemFour_Three)
    putAttributesActionFour.WithAttribute(attributeItemFour_Four)
    putAttributesActionFour.WithAttribute(attributeItemFour_Five)
    putAttributesActionFour.WithAttribute(attributeItemFour_Six)
    putAttributesActionFour.WithAttribute(attributeItemFour_Seven)
    putAttributesActionFour.WithAttribute(attributeItemFour_Eight)
    
    PutAttributesSample.InvokePutAttributes(service, putAttributesActionFour)
    
    '-------------------------------------------------------------------
    ' Load Item_05:
    '        Category = Car Parts
    '        Subcategory = Emissions
    '        Name = O2 Sensor
    '        Make = Audi
    '        Model = S4
    '        Year = 2000, 2001, 2002
    '-------------------------------------------------------------------
    Dim itemNameFive As String
    itemNameFive = "Item_05"
    
    Dim attributeItemFive_One As New ReplaceableAttribute
    attributeItemFive_One.WithName("Category").WithValue("Car Parts")
    Dim attributeItemFive_Two As New ReplaceableAttribute
    attributeItemFive_Two.WithName("Subcategory").WithValue("Emissions")
    Dim attributeItemFive_Three As New ReplaceableAttribute
    attributeItemFive_Three.WithName("Name").WithValue("O2 Sensor")
    Dim attributeItemFive_Four As New ReplaceableAttribute
    attributeItemFive_Four.WithName("Make").WithValue("Audi")
    Dim attributeItemFive_Five As New ReplaceableAttribute
    attributeItemFive_Five.WithName("Model").WithValue("S4")
    Dim attributeItemFive_Six As New ReplaceableAttribute
    attributeItemFive_Six.WithName("Year").WithValue("2000")
    Dim attributeItemFive_Seven As New ReplaceableAttribute
    attributeItemFive_Seven.WithName("Year").WithValue("2001")
    Dim attributeItemFive_Eight As New ReplaceableAttribute
    attributeItemFive_Eight.WithName("Year").WithValue("2002")
    
    Dim putAttributesActionFive As New PutAttributes()
    putAttributesActionFive.WithDomainName(domainName).WithItemName(itemNameFive)
    putAttributesActionFive.WithAttribute(attributeItemFive_One)
    putAttributesActionFive.WithAttribute(attributeItemFive_Two)
    putAttributesActionFive.WithAttribute(attributeItemFive_Three)
    putAttributesActionFive.WithAttribute(attributeItemFive_Four)
    putAttributesActionFive.WithAttribute(attributeItemFive_Five)
    putAttributesActionFive.WithAttribute(attributeItemFive_Six)
    putAttributesActionFive.WithAttribute(attributeItemFive_Seven)
    putAttributesActionFive.WithAttribute(attributeItemFive_Eight)
    
    PutAttributesSample.InvokePutAttributes(service, putAttributesActionFive)
    
  4. Run the sample.

    The name-value pairs are stored in Amazon SimpleDB.

Scratchpad

To run the sample

  1. Open the scratchpad application with a web browser.

  2. Add the attribute-value pairs for Item_01:

    1. Select PutAttributes from the Explore API list box.

    2. Enter MyStore in the Domain Name field.

    3. Enter Item_01 in the Item Name field.

    4. For the first name-value pair, enter Category in the Name field, Clothes in the Value field, and false in the Replace field.

    5. Click the plus button (+) to add each of the following additional name-value pairs:

      • Subcategory: Sweater

      • Name: Cathair Sweater

      • Color: Siamese

      • Size: Small

      • Size: Medium

      • Size: Large

    6. Select from the following:

      • To invoke the request, click Invoke Request.

        The name-value pairs are stored in Amazon SimpleDB

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

        The name-value pairs are stored in Amazon SimpleDB

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

  3. Add the attribute-value pairs for Item_02:

    1. Select PutAttributes from the Explore API list box.

    2. Enter MyStore in the Domain Name field.

    3. Enter Item_02 in the Item Name field.

    4. For the first name-value pair, enter Category in the Name field, Clothes in the Value field, and false in the Replace field.

    5. Click the plus button (+) to add each of the following additional name-value pairs:

      • Subcategory: Pants

      • Name: Designer Jeans

      • Color: Paisley Acid Wash

      • Size: 30x32

      • Size: 32x32

      • Size: 32x34

    6. Select from the following:

      • To invoke the request, click Invoke Request.

        The name-value pairs are stored in Amazon SimpleDB

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

        The name-value pairs are stored in Amazon SimpleDB

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

  4. Add the attribute-value pairs for Item_03:

    1. Select PutAttributes from the Explore API list box.

    2. Enter MyStore in the Domain Name field.

    3. Enter Item_03 in the Item Name field.

    4. For the first name-value pair, enter Category in the Name field, Clothes in the Value field, and false in the Replace field.

    5. Click the plus button (+) to add each of the following additional name-value pairs:

      • Subcategory: Pants

      • Name: Sweatpants

      • Color: Blue

      • Color: Yellow

      • Color: Pink

      • Size: Large

      • Year: 2006

      • Year: 2007

    6. Select from the following:

      • To invoke the request, click Invoke Request.

        The name-value pairs are stored in Amazon SimpleDB

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

        The name-value pairs are stored in Amazon SimpleDB

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

  5. Add the attribute-value pairs for Item_04:

    1. Select PutAttributes from the Explore API list box.

    2. Enter MyStore in the Domain Name field.

    3. Enter Item_04 in the Item Name field.

    4. For the first name-value pair, enter Category in the Name field, Car Parts in the Value field, and false in the Replace field.

    5. Click the plus button (+) to add each of the following additional name-value pairs:

      • Subcategory: Engine

      • Name: Turbos

      • Make: Audi

      • Model: S4

      • Year: 2000

      • Year: 2001

      • Year: 2002

    6. Select from the following:

      • To invoke the request, click Invoke Request.

        The name-value pairs are stored in Amazon SimpleDB

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

        The name-value pairs are stored in Amazon SimpleDB

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

  6. Add the attribute-value pairs for Item_05:

    1. Select PutAttributes from the Explore API list box.

    2. Enter MyStore in the Domain Name field.

    3. Enter Item_05 in the Item Name field.

    4. For the first name-value pair, enter Category in the Name field, Car Parts in the Value field, and false in the Replace field.

    5. Click the plus button (+) to add each of the following additional name-value pairs:

      • Subcategory: Emissions

      • Name: O2 Sensor

      • Make: Audi

      • Model: S4

      • Year: 2000

      • Year: 2001

      • Year: 2002

    6. Select from the following:

      • To invoke the request, click Invoke Request.

        The name-value pairs are stored in Amazon SimpleDB

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

        The name-value pairs are stored in Amazon SimpleDB

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