207 Multi-Status
The HTTP 207 Multi-Status status code indicates the response body contains status information for multiple resources. Unlike other 2xx status codes, 207 Multi-Status does not signal outright success. The message body contains an aggregate block of individual status codes, one per sub-operation.
Usage
A 207 Multi-Status response arrives when a single HTTP request touches multiple resources. For example, a POST request updating several databases might succeed on some and fail on others. The response body lists individual results for each resource.
By default, the body is an XML document with a
multistatus root element. The client parses each node
to determine the outcome of every sub-operation.
The root element contains zero or more response
elements in any order. Each response includes an
href element identifying the target resource. Two
formats exist: the status refers either to the resource
as a whole, or to specific properties of the resource.
WebDAV
The 207 Multi-Status status code is primarily used by WebDAV. Standard HTTP clients rarely encounter this response outside of WebDAV workflows.
Status of the resource as a whole
A child status element holds the resulting HTTP status
code for the identified resource. Clients are expected
to handle standard HTTP status codes found here.
<d:response>
<d:href>http://example.re/tasks</d:href>
<d:status>HTTP/1.1 200 OK</d:status>
</d:response>
Status of individual properties
The PROPFIND and PROPPATCH methods use propstat
in place of status to report on individual properties
of a resource.
<d:response>
<d:href>http://example.re/tasks</d:href>
<d:propstat>
<d:prop>
<d:getcontentlanguage>
"en-CA"
</d:getcontentlanguage>
</d:prop>
<d:status>HTTP/1.1 200 OK</d:status>
</d:propstat>
</d:response>
Success or failure indication
A 207 Multi-Status response signals overall success,
overall failure, or a mix of both. The client examines
each response element to assess completeness of the
operation.
Example
The client posts XML data to the server. Three independent resources are involved, and the server returns individual results for each one.
The first two resources succeed: the first returns no body (204) and the second confirms a new resource was created (201). The third resource reports a 423 error because a lock is held. The client determines whether the overall operation succeeded or failed based on these individual codes.
Request
POST /signup HTTP/1.1
Host: www.example.re
Content-Type: application/xml
Content-Length: 93
<?xml version="1.0"?>
<person>
<name>David Smith</name>
<country>USA</country>
</person>
Response
HTTP/1.1 207 Multi-Status
Content-Type: application/xml; charset="utf-8"
Content-Length: 568
<?xml version="1.0" encoding="utf-8" ?>
<d:multistatus xmlns:d="DAV:">
<d:response>
<d:href>http://example.re/signup/r1</d:href>
<d:status>HTTP/1.1 204 No Content</d:status>
</d:response>
<d:response>
<d:href>http://example.re/signup/r2</d:href>
<d:status>HTTP/1.1 201 Created</d:status>
</d:response>
<d:response>
<d:href>http://example.re/signup/r3</d:href>
<d:status>HTTP/1.1 423 Locked</d:status>
<d:error><d:lock-token-submitted/></d:error>
</d:response>
</d:multistatus>
Code references
.NET
HttpStatusCode.MultiStatus
Rust
http::StatusCode::MULTI_STATUS
Rails
:multi_status
Go
http.StatusMultiStatus
Symfony
Response::HTTP_MULTI_STATUS
Python3.5+
http.HTTPStatus.MULTI_STATUS
Apache HttpComponents Core
org.apache.hc.core5.http.HttpStatus.SC_MULTI_STATUS
Angular
@angular/common/http/HttpStatusCode.MultiStatus
Takeaway
HTTP response status code 207 Multi-Status wraps
individual status codes for operations on multiple
resources into a single response. The client iterates
through each response element to determine success
or failure per resource.
See also
- RFC 4918: HTTP Extensions for Web Distributed Authoring and Versioning (WebDAV)
- 208
- 422
- 423
- 424
- 200
- HTTP status codes