rest: return 400 when creating resource with invalid metric

Change-Id: I71d2ad35ae49adf431ecc3740117055fed406c2c
Merge "rest: return 400 when creating resource with invalid metric"