DeleteAttributes
Description
Deletes one or more attributes associated with the item. If all attributes of an item are deleted, the item is deleted.
Note
If you specify DeleteAttributes
without attributes or values, all
the attributes for the item are deleted.
Unless you specify conditions, the DeleteAttributes
is an idempotent operation; running it multiple
times on the same item or attribute does not result in an error
response.
Conditional deletes are useful for only deleting items and attributes if specific conditions are met. If the conditions are met, Amazon SimpleDB performs the delete. Otherwise, the data is not deleted.
When using eventually consistent reads, a GetAttributes or Select request (read) immediately after a DeleteAttributes or PutAttributes request (write) might not return the updated data. A consistent read always reflects all writes that received a successful response prior to the read. For more information, see Consistency.
You can perform the expected conditional check on one attribute per operation.
Request Parameters
Name | Description | Required |
---|---|---|
ItemName
|
The name of the item. Type: String |
Yes |
|
The name of the attribute. X can be any positive integer or
0. If you specify Type: String |
No |
|
The name of the attribute value (for multi-valued attributes). X can be any positive integer or 0. If an attribute value is specified, then the corresponding attribute name is required. Type: String |
No |
DomainName
|
The name of the domain in which to perform the operation. Type: String |
Yes |
|
Name of the attribute to check. Type: String. Conditions: Must be used with the expected value or expected exists parameter. When used with the expected value parameter, you specify the value to check.
When expected exists is set to Can only be used with single-valued attributes. |
Conditional |
|
Value of the attribute to check. Type: String. Conditions: Must be used with the expected name parameter.
Can be used with the expected exists parameter if that parameter is set to Can only be used with single-valued attributes. |
Conditional |
|
Flag to test the existence of an attribute while performing conditional updates. Type: Boolean. Conditions: Must be used with the expected name parameter. When set to Can only be used with single-valued attributes. |
Conditional |
Response Elements
Special Errors
Error | Description |
---|---|
AttributeDoesNotExist
|
Attribute ("+ name + ") does not exist. |
ConditionalCheckFailed
|
Conditional check failed. Attribute (" + name + ") value exists. |
ConditionalCheckFailed
|
Conditional check failed. Attribute ("+ name +") value is ("+ value +") but was expected ("+ expValue +"). |
ExistsAndExpectedValue
|
Expected.Exists=false and
Expected.Value cannot be specified
together. |
IncompleteExpectedExpression
|
If Expected.Exists=true or unspecified, then
Expected.Value has to be specified. |
InvalidParameterValue
|
Value (" + value + ") for parameter Expected.Exists is
invalid. Expected.Exists should be either
true or false . |
InvalidParameterValue
|
Value (" + value + ") for parameter Name is invalid.The empty
string is an illegal attribute name. |
InvalidParameterValue
|
Value (" + value + ") for parameter Name is invalid. Value
exceeds maximum length of 1024. |
InvalidParameterValue
|
Value (" + value + ") for parameter Value is invalid.
Value exceeds maximum length of 1024. |
InvalidParameterValue
|
Value (" + value + ") for parameter Item is invalid.
Value exceeds max length of 1024. |
InvalidWSDLVersion
|
Parameter (" + parameterName +") is only supported in WSDL version 2009-04-15 or beyond. Please upgrade to new version. |
MissingParameter
|
The request must contain the parameter
DomainName . |
MissingParameter
|
The request must contain the parameter
ItemName . |
MissingParameter
|
The request must contain the attribute Name , if an attribute
Value is specified. |
MultipleExistsConditions
|
Only one Exists condition can be specified. |
MultipleExpectedNames
|
Only one Expected.Name can be specified. |
MultipleExpectedValues
|
Only one Expected.Value can be specified. |
MultiValuedAttribute
|
Attribute (" + name + ") is multi-valued. Conditional check can only be performed on a single-valued attribute. |
NoSuchDomain
|
The specified domain does not exist. |
Examples
Sample Request
In this example, the Jumbo Fez has sold out in several colors. The following deletes the
red
, brick
, and garnet
values from the
color
attribute of the JumboFez
item.
https://sdb.amazonaws.com/ ?Action=DeleteAttributes &Attribute.1.Name=color &Attribute.1.Value=red &Attribute.2.Name=color &Attribute.2.Value=brick &Attribute.3.Name=color &Attribute.3.Value=garnet &AWSAccessKeyId=[valid access key id] &DomainName=MyDomain &ItemName=JumboFez &SignatureVersion=2 &SignatureMethod=HmacSHA256 &Timestamp=2010-01-25T15%3A03%3A07-07%3A00 &Version=2009-04-15 &Signature=[valid signature]
Sample Response
<DeleteAttributesResponse"> <ResponseMetadata> <RequestId>05ae667c-cfac-41a8-ab37-a9c897c4c3ca</RequestId> <BoxUsage>0.0000219907</BoxUsage> </ResponseMetadata> </DeleteAttributesResponse>
Sample Request
In this example, the Micro Fez has sold out. The following deletes the Micro Fez if the quantity reaches 0
Note
For more examples of conditional operations, see Conditionally Putting and Deleting Data.
https://sdb.amazonaws.com/ ?Action=DeleteAttributes &ItemName=MicroFez &Expected.Name=quantity &Expected.Value=0 &SignatureVersion=2 &SignatureMethod=HmacSHA256 &Timestamp=2010-01-25T15%3A03%3A07-07%3A00 &Version=2009-04-15 &Signature=[valid signature]
Sample Response
<DeleteAttributesResponse> <ResponseMetadata> <RequestId>05ae667c-cfac-41a8-ab37-a9c897c4c3ca</RequestId> <BoxUsage>0.0000219907</BoxUsage> </ResponseMetadata> </DeleteAttributesResponse>