<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to schedule/refresh databricks alerts using REST API? in Get Started Discussions</title>
    <link>https://community.databricks.com/t5/get-started-discussions/how-to-schedule-refresh-databricks-alerts-using-rest-api/m-p/49416#M1591</link>
    <description>&lt;P&gt;What they mention in the API docs is that you can create a job with sql_task of type Alert. To make it easier you can try creating the job first in the UI first and downloading the JSON config. Here is an example with the main parameters that should work for what you are trying to do:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;{
    "job_id": 1111,
    ...
    "settings": {
        "name": "test_sql_task",
        ...
        "schedule": {
            "quartz_cron_expression": "34 30 20 * * ?",
            "timezone_id": "UTC",
            "pause_status": "UNPAUSED"
        },
        "tasks": [
            {
                "task_key": "test_sql_task",
                "run_if": "ALL_SUCCESS",
                "sql_task": {
                    "alert": {
                        "alert_id": "009f4ff1-0493-4e58-9224-7ea4dcca0f99",
                        "subscriptions": [
                            {
                                "user_name": "test@email.com"
                            }
                        ]
                    },
                    "warehouse_id": "475b94ddc7cd5211"
                }
            }
        ],
        ...
    }
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 17 Oct 2023 19:36:45 GMT</pubDate>
    <dc:creator>btafur</dc:creator>
    <dc:date>2023-10-17T19:36:45Z</dc:date>
    <item>
      <title>How to schedule/refresh databricks alerts using REST API?</title>
      <link>https://community.databricks.com/t5/get-started-discussions/how-to-schedule-refresh-databricks-alerts-using-rest-api/m-p/49384#M1590</link>
      <description>&lt;P&gt;Hi, I am deploying Databricks SQL alerts using REST API. But I can't seem to figure out how to schedule their refresh task.&lt;/P&gt;&lt;P&gt;I went through the documentation it says "&lt;EM&gt;Alerts can be scheduled using the&amp;nbsp;sql_task&amp;nbsp;type of the Jobs API, e.g.&amp;nbsp;&lt;A href="https://docs.databricks.com/api/workspace/jobs/create" target="_blank" rel="noopener"&gt;Jobs/Create"&lt;/A&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Abhiqa_0-1697550139434.png" style="width: 400px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/4477i081A9166BE2A0357/image-size/medium/is-moderation-mode/true?v=v2&amp;amp;px=400" role="button" title="Abhiqa_0-1697550139434.png" alt="Abhiqa_0-1697550139434.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;However, in the sql_task of the jobs API, there is no example of scheduling sql_task (query or alert). Having said that, I also tried to schedule using the "Schedule" key of job api eg&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;"schedule"&lt;/SPAN&gt;&lt;SPAN&gt;: {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;"quartz_cron_expression"&lt;/SPAN&gt;&lt;SPAN&gt;: &lt;/SPAN&gt;&lt;SPAN&gt;"0 0 0/4 * * ?"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;"timezone_id"&lt;/SPAN&gt;&lt;SPAN&gt;: &lt;/SPAN&gt;&lt;SPAN&gt;"US/Mountain"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;"pause_status"&lt;/SPAN&gt;&lt;SPAN&gt;: &lt;/SPAN&gt;&lt;SPAN&gt;"UNPAUSED"&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;SPAN&gt;still no luck,&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Could you please help me by giving a working example of scheduling a refresh for an alert payload, so alert schedule appears in the below screen? Thank you very much&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Abhiqa_1-1697550638337.png" style="width: 400px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/4478i6171929685E106A7/image-size/medium/is-moderation-mode/true?v=v2&amp;amp;px=400" role="button" title="Abhiqa_1-1697550638337.png" alt="Abhiqa_1-1697550638337.png" /&gt;&lt;/span&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Oct 2023 14:00:27 GMT</pubDate>
      <guid>https://community.databricks.com/t5/get-started-discussions/how-to-schedule-refresh-databricks-alerts-using-rest-api/m-p/49384#M1590</guid>
      <dc:creator>Abhiqa</dc:creator>
      <dc:date>2023-10-17T14:00:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to schedule/refresh databricks alerts using REST API?</title>
      <link>https://community.databricks.com/t5/get-started-discussions/how-to-schedule-refresh-databricks-alerts-using-rest-api/m-p/49416#M1591</link>
      <description>&lt;P&gt;What they mention in the API docs is that you can create a job with sql_task of type Alert. To make it easier you can try creating the job first in the UI first and downloading the JSON config. Here is an example with the main parameters that should work for what you are trying to do:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;{
    "job_id": 1111,
    ...
    "settings": {
        "name": "test_sql_task",
        ...
        "schedule": {
            "quartz_cron_expression": "34 30 20 * * ?",
            "timezone_id": "UTC",
            "pause_status": "UNPAUSED"
        },
        "tasks": [
            {
                "task_key": "test_sql_task",
                "run_if": "ALL_SUCCESS",
                "sql_task": {
                    "alert": {
                        "alert_id": "009f4ff1-0493-4e58-9224-7ea4dcca0f99",
                        "subscriptions": [
                            {
                                "user_name": "test@email.com"
                            }
                        ]
                    },
                    "warehouse_id": "475b94ddc7cd5211"
                }
            }
        ],
        ...
    }
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Oct 2023 19:36:45 GMT</pubDate>
      <guid>https://community.databricks.com/t5/get-started-discussions/how-to-schedule-refresh-databricks-alerts-using-rest-api/m-p/49416#M1591</guid>
      <dc:creator>btafur</dc:creator>
      <dc:date>2023-10-17T19:36:45Z</dc:date>
    </item>
  </channel>
</rss>

