Get a prediction server ID¶
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.
Before proceeding, note that an API key is required for this tutorial. Reference the Create API keys tutorial for more information.
curl -v \ -H "Authorization: Bearer API_KEY" \ YOUR_DR_URL/api/v2/predictionServers/ Example API_KEY=YOUR_API_KEY ENDPOINT=YOUR_DR_URL/api/v2/predictionServers/ curl -v \ -H "Authorization: Bearer $API_KEY" \ $ENDPOINT
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 environment import os import datarobot as dr API_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 instance dr.Client( token=API_KEY, endpoint=ENDPOINT ) prediction_server_id = dr.PredictionServer.list().id print(prediction_server_id)
The following provides additional documentation for features mentioned in this tutorial.