kenshin9
kenshin9

Reputation: 2365

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?

Upvotes: 19

Views: 25070

Answers (1)

Prajwal
Prajwal

Reputation: 4000

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

Upvotes: 24

Related Questions