batch_delete_attributes ( $domain_name, $item_keypairs, $opt )

Performs multiple DeleteAttributes operations in a single call, which reduces round trips and latencies. This enables Amazon SimpleDB to optimize requests, which generally yields better throughput.

If you specify BatchDeleteAttributes without attributes or values, all the attributes for the item are deleted. BatchDeleteAttributes is an idempotent operation; running it multiple times on the same item or attribute doesn’t result in an error. The BatchDeleteAttributes operation succeeds or fails in its entirety. There are no partial deletes.

You can execute multiple BatchDeleteAttributes operations and other operations in parallel. However, large numbers of concurrent BatchDeleteAttributes calls can result in Service Unavailable (503) responses. This operation does not support conditions using Expected.X.Name, Expected.X.Value, or Expected.X.Exists.

The following limitations are enforced for this operation:

  • 1 MB request size
  • 25 item limit per BatchDeleteAttributes operation

Access

public

Parameters

Parameter

Type

Required

Description

$domain_name

string

Required

The name of the domain in which the attributes are being deleted.

$item_keypairs

array

Required

Associative array of parameters which are treated as item-key-value and item-key-multivalue pairs (i.e. a key can have one or more values; think tags).

  • [item] - array - Set the custom item name as the key for this value.
    • [key] - array - Set the custom key name as the key for this value. For the value, pass a string for a single value, or an indexed array for multiple values.

$opt

array

Optional

An associative array of parameters that can have the following keys:

  • Item - array - Optional - A list of items on which to perform the operation.
    • x - array - This represents a simple array index.
      • ItemName - string - Optional - This is the parameter format supported by the web service API. This is the item name to use.
      • Attribute - array - Optional - This is the parameter format supported by the web service API. This is the attribute node.
        • x - array - This represents a simple array index.
          • Name - string - Required - The name of the attribute.
          • AlternateNameEncoding - string - Optional - This is the parameter format supported by the web service API. This is the alternate name encoding to use.
          • Value - string - Required - The value of the attribute.
          • AlternateValueEncoding - string - Optional - This is the parameter format supported by the web service API. This is the alternate value encoding to use.
  • curlopts - array - Optional - A set of values to pass directly into curl_setopt(), where the key is a pre-defined CURLOPT_* constant.
  • returnCurlHandle - boolean - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This is useful for manually-managed batch requests.

Returns

Type

Description

CFResponse

A CFResponse object containing a parsed HTTP response.

Examples

Delete a series of item-key-value pairs.

// Instantiate
$sdb = new AmazonSDB();

// Test data
$response = $sdb->batch_delete_attributes('example-domain', array(
	'item1' => array(
		'key1' => 'value1',
		'key2' => array(
			'value1',
			'value2',
			'value3',
		),
		'key3' => array('value1'),
	),
	'item2' => array(
		'key1' => 'value1',
		'key2' => array(
			'value1',
			'value2',
			'value3',
		),
		'key3' => array('value1'),
	),
	'item3' => array(
		'key1' => 'value1',
		'key2' => array(
			'value1',
			'value2',
			'value3',
		),
		'key3' => array('value1'),
	),
));

// Success?
var_dump($response->isOK());
Result:
bool(true)

Related Methods

Source

Method defined in services/sdb.class.php | Toggle source view (19 lines) | View on GitHub

public function batch_delete_attributes($domain_name, $item_keypairs, $opt = null)
{
    if (!$opt) $opt = array();
    $opt['DomainName'] = $domain_name;

    $opt = array_merge($opt, CFComplexType::map(
        self::remap_batch_items_for_complextype($item_keypairs)
    ));

    if (isset($opt['Item']))
    {
        $opt = array_merge($opt, CFComplexType::map(array(
            'Item' => $opt['Item']
        )));
        unset($opt['Item']);
    }

    return $this->authenticate('BatchDeleteAttributes', $opt, $this->hostname);
}

Copyright © 2010–2013 Amazon Web Services, LLC


Feedback