wrapper function for rest api