BZ-1074989 - REST API returns HTTP code 500 even though it is obviously not a server error and rather incorrect request

(cherry picked from commit 6914081cbb12caa236634269fc077c2ba7d0c6d6)