Rest API returning incorrect data