Add update function to the api