Create methods for prediction api and api request handler function