RestAPI: Add explicit error when PUT mapping API is given an empty request body.

I also added validation for an empty type, and added tests (just for validation for now).

closes #7536