complete rest api implementation