In order to make predictions from a deployment via DataRobot's Prediction API, you need a prediction server ID. In this tutorial, you'll learn how to retrieve the ID using cURL commands from the REST API or by using the DataRobot Python client. Once obtained, you can use the prediction server ID to deploy a model and make predictions.
Note
Before proceeding, note that an API key is required for this tutorial. Reference the Create API keys tutorial for more information.
Before continuing with Python, be sure you have installed the DataRobot Python client and configured your connection to DataRobot as outlined in the API quickstart guide.
# Set up your environmentimportosimportdatarobotasdrAPI_KEY=os.environ["API_KEY"]YOUR_DR_URL=os.environ["YOUR_DR_URL"]FILE_PATH=os.environ["FILE_PATH"]ENDPOINT=YOUR_DR_URL+"/api/v2"# Instantiate DataRobot instancedr.Client(token=API_KEY,endpoint=ENDPOINT)prediction_server_id=dr.PredictionServer.list()[0].idprint(prediction_server_id)