cherry pick of MIFOSX-368: fix error message being returned based on parameters being passed to api.