HTTP Status Code 424 – Failed Dependency
The HTTP status code 424 Failed Dependency indicates that the request failed because it depended on another request that also failed. This status code is typically used in the context of WebDAV (Web Distributed Authoring and Versioning) when performing operations on resources that are interdependent.
Examples
Example 1: WebDAV LOCK Request Failure
LOCK /example/resource HTTP/1.1
Host: www.example.com
Timeout: Infinite, Second-4100000000
In this scenario, a client attempts to lock a resource but the lock depends on a previous lock request that failed. When the server tries to process this LOCK request, it encounters a dependency issue and returns a 424 status code:
HTTP/1.1 424 Failed Dependency
Content-Type: application/xml
<D:error xmlns:D="DAV:">
<D:failed-dependency/>
</D:error>
Example 2: PROPPATCH Request Failure
PROPPATCH /example/resource HTTP/1.1
Host: www.example.com
Content-Type: text/xml; charset="utf-8"
Content-Length: xxxx
<?xml version="1.0" encoding="utf-8" ?>
<D:propertyupdate xmlns:D="DAV:">
<D:set>
<D:prop>
<D:custom-property>value</D:custom-property>
</D:prop>
</D:set>
</D:propertyupdate>
In this example, a client issues a PROPPATCH request to change a property’s value on a resource. If this operation depends on a prior operation (such as a previous PROPPATCH or LOCK) that failed, the server will respond with a 424 status code:
HTTP/1.1 424 Failed Dependency
Content-Type: application/xml
<D:error xmlns:D="DAV:">
<D:failed-dependency/>
</D:error>
Example 3 failed Scenario
# Client sends a request example. GET /example HTTP/1.1 Host: www.example.com # Server Response HTTP/1.1 424 424 Failed Dependency Date: Wed, 09 Oct 2024 23:06:36 GMT Server: ExampleServer/1.0 Content-Type: application/json { "error": "Description of the error for 424" }
Example 4: Heres Another Scenario
# Client sends another example request. POST /another-example HTTP/1.1 Host: www.example.com # Server Response HTTP/1.1 424 424 Failed Dependency Date: Wed, 09 Oct 2024 23:06:36 GMT Server: ExampleServer/1.0 Content-Type: application/json { "error": "Detailed message for 424" }
Summary
The 424 Failed Dependency status code is used to indicate that a request cannot be processed because it is reliant on another request that has failed. This code is mainly relevant in WebDAV operations, where multiple requests might be part of a larger transaction. Understanding the role of dependency in these requests is crucial for diagnosing issues when this status code is encountered.