revised requestapi function