Rest API draft code.. Does not work