Quantcast
Channel: Question and Answer » web-services
Viewing all articles
Browse latest Browse all 136

Should a web service return an error message if it receives unknown parameters?

$
0
0

I have a web service which allows to retrieve users: http://example.com/users. It returns a list of users.

That service accepts a number of parameters (age, gender) to select which users to retrieve. Examples:

  • http://example.com/users?age=34
  • http://example.com/users?gender=male

Should that service return an error message if the client is passing an unknown parameter? Example:

>>> GET http://example.com/users?cylinders=16 
<<< 400 Bad Request
<<< { 'message' : "Invalid parameter 'cylinders'" }

(To me it’s clear that a web service should validate the parameters it receives, but the case of unknown parameters is not clear to me)


Viewing all articles
Browse latest Browse all 136

Trending Articles