rest api now saves data correctly