changed call from jquery to api method