WebDAV Batch Methods
Topic Last Modified: 2006-06-12
It is sometimes necessary to perform an action against a large set of resources, such as deleting 900 resources from a collection. Using the DELETE Method for this task would require 900 individual requests and responses. The WebDAV batch methods, the BCOPY Method, the BDELETE Method, the BMOVE Method, the BPROPFIND Method, and the BPROPPATCH Method, allow a single request to perform an operation on multiple targets. For example, the BMOVE Method allows the client to request that multiple target resources be moved to a destination collection.
Each batch request specifies an operation to be performed on multiple targets. The request Uniform Resource Identifier (URI) of a batch request is a collection that defines the scope of the targets. All targets must exist within this scope.
The root element of a multi-target request body must contain a <D:target> element that defines a set of URIs to which the request is to be applied. These URIs can be relative to the request URI. For Distributed Authoring and Versioning (DAV) methods whose non-batch equivalent does not define a request body, the batch equivalent defines a text/xml request body whose root element corresponds to the DAV method name.
A response to a batch request is usually in the form of a 207 (Multi-Status) response. When a status code must be returned for an entire resource, such as 404 (Not Found), a status element may be added to the response node.
If all operations produce the same successful response, the response body might be omitted, indicating that the HTTP response code applies to all targets. This convention cannot be used when the response body is used to transmit data, such as in a successful PROPFIND Method, or when the response body is necessary to show that an error, such as 404 (Not Found), applies to properties on each resource, rather than to the resources themselves.