API call getting rejected