HTTP status code 207 “Multi-Status” is primarily used in WebDAV environments and indicates that the server has successfully processed the request but the response contains multiple resource statuses, potentially including various status codes like 200, 300, 400, and 500 series codes.
Use Case
When a client sends a request that involves operations on multiple resources, the server can return a response with a 207 status code, detailing the outcome of each resource operation. This allows the client to understand the results of each operation, such as successful resource creation or failures due to conflicts or permission issues.
Response Format
The response body is typically in text/xml
or application/xml
format and contains a multistatus
root element, listing the statuses of each resource. For example, the response might look like this:
HTTP/1.1 207 Multi-Status
Content-Type: application/xml; charset="utf-8"
Content-Length: 1241
<?xml version="1.0" encoding="utf-8" ?>
<D:multistatus xmlns:D="DAV:">
<D:response>
<D:href>http://www.example.com/Coll/</D:href>
<D:propstat>
<D:prop>
<D:displayname>Loop Demo</D:displayname>
<D:resource-id>
<D:href>urn:uuid:f81d4fae-7dec-11d0-a765-00a0c91e6bf8</D:href>
</D:resource-id>
</D:prop>
<D:status>HTTP/1.1 200 OK</D:status>
</D:propstat>
</D:response>
<D:response>
<D:href>http://www.example.com/Coll/Bar</D:href>
<D:propstat>
<D:prop>
<D:displayname>Loop Demo</D:displayname>
<D:resource-id>
<D:href>urn:uuid:f81d4fae-7dec-11d0-a765-00a0c91e6bf8</D:href>
</D:resource-id>
</D:prop>
<D:status>HTTP/1.1 208 Already Reported</D:status>
</D:propstat>
</D:response>
</D:multistatus>
In this example, the server returns a 207 status code response containing the processing results of two resources. The first resource (Coll/) has a status of 200 OK, indicating successful processing, while the second resource (Coll/Bar) has a status of 208 Already Reported, suggesting that its status has been reported in a previous response.