Added RestAPI and fixed retrieval