TIMEX
TIMEX

Reputation: 271694

What is the status code I return on an API when a parameter passed does not meet requirements?

Let's say the person passed in "5", when the parameter must be 0 or 1.

Upvotes: 0

Views: 66

Answers (1)

StaxMan
StaxMan

Reputation: 116502

I would actually suggest 400 (Bad Request) which is typically used for cases like this. More information is usually returned as payload (to indicate which parameter was at fault, with possible acceptable value range etc).

Upvotes: 3

Related Questions