cancel
Showing results for 
Search instead for 
Did you mean: 
Machine Learning
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.

Welcome to Databricks Community: Lets learn, network and celebrate together

Join our fast-growing data practitioner and expert community of 80K+ members, ready to discover, help and collaborate together while making meaningful connections. 

Click here to register and join today! 

Engage in exciting technical discussions, join a group with your peers and meet our Featured Members.