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.

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you wonโ€™t want to miss the chance to attend and share knowledge.

If there isnโ€™t a group near you, start one and help create a community that brings people together.

Request a New Group