Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Note
This information applies to Databricks CLI versions 0.205 and above. The Databricks CLI is in Public Preview.
Databricks CLI use is subject to the Databricks License and Databricks Privacy Notice, including any Usage Data provisions.
The api
command group within the Databricks CLI enables you to call any available Databricks REST API.
You should run the api
command only for advanced scenarios, such as preview releases of specific Databricks REST APIs for which the Databricks CLI does not already wrap the target Databricks REST API within a related command. For a list of command groups, see Databricks CLI commands.
databricks api delete
Perform DELETE request
databricks api delete PATH [flags]
Arguments
PATH
The API endpoint path
Options
--json JSON
The inline JSON string or the @path to the JSON file with the request body
Examples
databricks api delete /api/2.0/jobs/runs/delete --json '{"run_id": 123}'
databricks api get
Perform GET request
databricks api get PATH [flags]
Arguments
PATH
The API endpoint path
Options
--json JSON
The inline JSON string or the @path to the JSON file with the request body
Examples
The following example gets the list of available clusters in the workspace:
databricks api get /api/2.0/clusters/list
The following example gets a job:
databricks api get /api/2.0/jobs/get --json '{"job_id": 123}'
databricks api head
Perform HEAD request
databricks api head PATH [flags]
Arguments
PATH
The API endpoint path
Options
--json JSON
The inline JSON string or the @path to the JSON file with the request body
Examples
databricks api head /api/2.0/clusters/list
databricks api patch
Perform PATCH request
databricks api patch PATH [flags]
Arguments
PATH
The API endpoint path
Options
--json JSON
The inline JSON string or the @path to the JSON file with the request body
Examples
databricks api patch /api/2.0/jobs/update --json '{"job_id": 123, "new_settings": {"name": "Updated Job"}}'
databricks api post
Perform POST request
databricks api post PATH [flags]
Arguments
PATH
The API endpoint path
Options
--json JSON
The inline JSON string or the @path to the JSON file with the request body
Examples
The following example gets information about the specified cluster in the workspace.
databricks api post /api/2.0/clusters/get --json '{
"cluster_id": "1234-567890-abcde123"
}'
The following example creates a cluster:
databricks api post /api/2.0/clusters/create --json '{"cluster_name": "test-cluster", "spark_version": "11.3.x-scala2.12"}'
Update settings for the specified cluster in the workspace.
databricks api post /api/2.0/clusters/edit --json '{
"cluster_id": "1234-567890-abcde123",
"cluster_name": "my-changed-cluster",
"num_workers": 1,
"spark_version": "11.3.x-scala2.12",
"node_type_id": "Standard_DS3_v2"
}'
Update settings for the specified cluster in the workspace. Get the request body from a file named edit-cluster.json
within the current working directory.
databricks api post /api/2.0/clusters/edit --json @edit-cluster.json
edit-cluster.json
:
{
"cluster_id": "1234-567890-abcde123",
"cluster_name": "my-changed-cluster",
"num_workers": 1,
"spark_version": "11.3.x-scala2.12",
"node_type_id": "Standard_DS3_v2"
}
databricks api put
Perform PUT request
databricks api put PATH [flags]
Arguments
PATH
The API endpoint path
Options
--json JSON
The inline JSON string or the @path to the JSON file with the request body
Examples
databricks api put /api/2.0/workspace/import --json @workspace-import.json
Global flags
--debug
Whether to enable debug logging.
-h
or --help
Display help for the Databricks CLI or the related command group or the related command.
--log-file
string
A string representing the file to write output logs to. If this flag is not specified then the default is to write output logs to stderr.
--log-format
format
The log format type, text
or json
. The default value is text
.
--log-level
string
A string representing the log format level. If not specified then the log format level is disabled.
-o, --output
type
The command output type, text
or json
. The default value is text
.
-p, --profile
string
The name of the profile in the ~/.databrickscfg
file to use to run the command. If this flag is not specified then if it exists, the profile named DEFAULT
is used.
--progress-format
format
The format to display progress logs: default
, append
, inplace
, or json
-t, --target
string
If applicable, the bundle target to use