Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What StatusCode should I return to parameters out of range

I am not sure what status code should I return to client. When the request has parameters out of range. My API support paging from page 1 to (let's say) 50. Which status code should server return to

page < 1 || page > 50

like image 751
zdarsky.peter Avatar asked Dec 11 '25 05:12

zdarsky.peter


1 Answers

See http codes and explanation for example here: http://en.wikipedia.org/wiki/List_of_HTTP_status_codes

You should use some of the 4xx codes, because it's error on client side.

Let's use the 400 (Bad Request) status code. It's general error code, so it should be right.

like image 180
Gh61 Avatar answered Dec 14 '25 11:12

Gh61



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!