cancel
Showing results for 
Search instead for 
Did you mean: 
Machine Learning
Dive into the world of machine learning on the Databricks platform. Explore discussions on algorithms, model training, deployment, and more. Connect with ML enthusiasts and experts.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to enable and disable Model Serving using Rest API

Mohit_m
Valued Contributor II

ML flow model serving in Databricks docs details the options to enable and disable from the UI

https://docs.databricks.com/applications/mlflow/model-serving.html

1 ACCEPTED SOLUTION

Accepted Solutions

Mohit_m
Valued Contributor II

Please find below the REST APIs to enable and disable Model-Serving

Below are the examples in Python

You need to use the token to interact with Rest API

token = "dxxxxxx"

instance = "https://<workspacexxx>.cloud.databricks.com"

headers = {'Authorization': f'Bearer {token}'}

Enable Model Serving

import requests

url = f'https://{instance}/api/2.0/mlflow/endpoints/enable'

requests.post(url, headers=headers, json={"registered_model_name": "<model name>"})

Disable Model serving

url = f'https://{instance}/api/2.0/mlflow/endpoints/disable'

r = requests.post(url, headers=headers, json={"registered_model_name": "<model name>"})

r.json()

View solution in original post

2 REPLIES 2

Mohit_m
Valued Contributor II

Please find below the REST APIs to enable and disable Model-Serving

Below are the examples in Python

You need to use the token to interact with Rest API

token = "dxxxxxx"

instance = "https://<workspacexxx>.cloud.databricks.com"

headers = {'Authorization': f'Bearer {token}'}

Enable Model Serving

import requests

url = f'https://{instance}/api/2.0/mlflow/endpoints/enable'

requests.post(url, headers=headers, json={"registered_model_name": "<model name>"})

Disable Model serving

url = f'https://{instance}/api/2.0/mlflow/endpoints/disable'

r = requests.post(url, headers=headers, json={"registered_model_name": "<model name>"})

r.json()

Hi @Mohit Miglani​ ,

Great post. Thank you for sharing it with the rest of the community.

Join 100K+ Data Experts: Register Now & Grow with Us!

Excited to expand your horizons with us? Click here to Register and begin your journey to success!

Already a member? Login and join your local regional user group! If there isn’t one near you, fill out this form and we’ll create one for you to join!