added user auth in api and modified PUT method, modified other methods