API to run Databricks notebook or workflow

Hi, can I ask if there is any way to connect to Databricks and run a notebook or workflow that is set up in Databricks? Is there an API available to do that?
Thanks

Hi @qwww,

you can simply set up a new REST API resource with the parameters of your workspace:

  1. Create a new REST API resource.

  2. Copy the base url from your Databricks Workspace (looks something like this: https://adb-2138932148234831.19.azuredatabricks.net/)

  3. Set the Headers to Content-Type: application/json and "Authorization: Bearer [your personal acces token] - you can generate a token by clicking SQL Warehouses --> Choose a warehouse --> Connection details --> click "create personalaccess token" (bottom right) --> generate a new token

  4. Now that you have the base connection established, you can use the endpoint to run a job. Simply specify the url path and set the body to JSON with the parameter "job_id": [JOB ID from Databricks].

Resource configuration:

Job run API:

Let me know if you have any questions!

Many thanks Jonas. I have managed to get this working!

1 Like