422 Unprocessable Entity

422 Unprocessable Entity

The 422 HTTP status code is returned by the server when it receives a request with a valid content type and correct syntax, but it cannot execute the instructions given in the request.

You can Check Your URLs HTTP Code for FREE

Introduction
In Action
Sample
Conclusion

Introduction

The HTTP status code 422 Unprocessable Entity is returned by the server when it receives a request with a valid content type and correct syntax, but it cannot execute the instructions given in the request.

In other words, the server understands the data sent by the client, but it cannot perform the action requested due to some logical constraint or business rule.

In Action

When the server returns the 422 Unprocessable Entity error message, it means that it cannot fulfill the request because the data provided in the request is valid and understood but contains logical errors that prevent its execution.

This status ensures that the client is aware of the specific issue with the data, distinguishing it from other potential errors like unsupported media type or bad syntax.

An example of this error could be when a client sends XML data with correct syntax, but the logical instructions inside the data cause an issue on the server-side.

Sample

In the example, the client sends an XML document to the server, asking it to start task #100. The server acknowledges the XML format and verifies that it is syntactically correct.

However, upon checking its records, the server finds that there is no task with id=100. As a result, the server cannot fulfill the request to start the task.

Request

POST /requests HTTP/1.1
Host: www.example.com
Content-Type: application/xml
Content-Length: 101

< ?xml version=”1.0″ encoding=”utf-8″?>
< request>
< id>100< /id>
< action>start< /action>
< /request>

Response

HTTP/1.1 422 Unprocessable Entity
Content-Type: text/html
Content-Length: 150

< html>
< head>
< title>Request Failed< /title>
< /head>
< body>
< p>Task #100 is not recognized and cannot be started.< /p>
< /body>
< /html>

Conclusion

The 422 Unprocessable Entity error occurs when the server receives a request with a valid and understood content type and syntax, but it cannot process the instructions specified in the request. It is like receiving a well-formed message that the server knows how to read, but the requested action cannot be carried out due to logical errors or data mismatch.

Related articles

999 Request Denied

999 Request Denied The 999 HTTP response status code is...

599 Network Connect Timeout Error

599 Network Connect Timeout Error The 599 HTTP response status...

598 Network read timeout error

598 Network read timeout error The 598 HTTP response status...

561 Unauthorized

561 Unauthorized The 561 HTTP response status code means there...

530 Site Frozen

530 Site Frozen The 530 HTTP response status code is...

999 Request Denied

0
999 Request Denied The 999 HTTP response status code is an unofficial catch-all error code returned...

599 Network Connect Timeout Error

0
599 Network Connect Timeout Error The 599 HTTP response status code indicates a timeout when trying...

598 Network read timeout error

0
598 Network read timeout error The 598 HTTP response status code indicates a timeout occurred during...

561 Unauthorized

0
561 Unauthorized The 561 HTTP response status code means there was an authentication failure. You can Check...

530 Site Frozen

0
530 Site Frozen The 530 HTTP response status code is a specialized server error used by...