Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTTP status code for invalid format

Our system is accepting a text file upload and is supposed to have a pre-determined line count. If the line count doesn't match up, I want to send a warning of sorts back to the user asking to confirm that they want to upload anyway.

Is there a particular status code I can use for something like this?

like image 414
kenshin9 Avatar asked Dec 01 '16 20:12

kenshin9


1 Answers

You can use 422.

The 422 (Unprocessable Entity) status code means the server understands the content type of the request entity (hence a 415(Unsupported Media Type) status code is inappropriate), and the syntax of the request entity is correct (thus a 400 (Bad Request) status code is inappropriate) but was unable to process the contained instructions.

You can check this out.

rest API Tutorial - HTTP Status Codes

like image 88
Prajwal Avatar answered Sep 30 '22 13:09

Prajwal