<?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: Unable to Create Alert Using API in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/unable-to-create-alert-using-api/m-p/107384#M42791</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/146221"&gt;@zg&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;&lt;BR /&gt;You are sending the payload related to the new endpoint (/api/2.0/sql/alerts) to the old endpoint (&lt;SPAN&gt;/api/2.0/preview/sql/alerts).&lt;BR /&gt;&lt;BR /&gt;That are the docs of the old endpoint:&lt;BR /&gt;&lt;A href="https://docs.databricks.com/api/workspace/alertslegacy/create" target="_blank"&gt;https://docs.databricks.com/api/workspace/alertslegacy/create&lt;/A&gt;&lt;BR /&gt;As you can see the field is called "name"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="filipniziol_0-1738058526972.png" style="width: 400px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/14385i77C688999CEAF59A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="filipniziol_0-1738058526972.png" alt="filipniziol_0-1738058526972.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;In the new endpoint the name is called "display_name":&lt;BR /&gt;&lt;A href="https://docs.databricks.com/api/workspace/alerts/create" target="_blank"&gt;https://docs.databricks.com/api/workspace/alerts/create&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;To sum up, just change your endpoint from&amp;nbsp;&lt;SPAN&gt;/api/2.0/preview/sql/alerts to&amp;nbsp;/api/2.0/sql/alerts and it should work.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 28 Jan 2025 10:03:12 GMT</pubDate>
    <dc:creator>filipniziol</dc:creator>
    <dc:date>2025-01-28T10:03:12Z</dc:date>
    <item>
      <title>Unable to Create Alert Using API</title>
      <link>https://community.databricks.com/t5/data-engineering/unable-to-create-alert-using-api/m-p/107265#M42749</link>
      <description>&lt;P&gt;Hi All,&amp;nbsp;I'm trying to create an alert using the Databricks REST API, but I keep encountering the following error:&lt;BR /&gt;Error creating alert: 400 {"message": "Alert name cannot be empty or whitespace"}:&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;{&lt;BR /&gt;"alert": {&lt;BR /&gt;"seconds_to_retrigger": 0,&lt;BR /&gt;"display_name": "AlertTest",&lt;BR /&gt;"condition": {&lt;BR /&gt;"op": "EQUAL",&lt;BR /&gt;"operand": {&lt;BR /&gt;"column": {&lt;BR /&gt;"name": "Id"&lt;BR /&gt;}&lt;BR /&gt;},&lt;BR /&gt;"threshold": {&lt;BR /&gt;"value": {&lt;BR /&gt;"double_value": 1&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;},&lt;BR /&gt;"query_id": "123e4567-e89b-12d3-a456-426614174000",&amp;nbsp;&lt;BR /&gt;"parent_path": "/Workspace/Users/user@mail.com"&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jan 2025 16:07:48 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/unable-to-create-alert-using-api/m-p/107265#M42749</guid>
      <dc:creator>zg</dc:creator>
      <dc:date>2025-01-27T16:07:48Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to Create Alert Using API</title>
      <link>https://community.databricks.com/t5/data-engineering/unable-to-create-alert-using-api/m-p/107271#M42751</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/146221"&gt;@zg&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;Could you please share the REST API Endpoint you are making the request to?&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jan 2025 17:27:55 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/unable-to-create-alert-using-api/m-p/107271#M42751</guid>
      <dc:creator>Alberto_Umana</dc:creator>
      <dc:date>2025-01-27T17:27:55Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to Create Alert Using API</title>
      <link>https://community.databricks.com/t5/data-engineering/unable-to-create-alert-using-api/m-p/107374#M42788</link>
      <description>&lt;P&gt;Hello &lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/106294"&gt;@Alberto_Umana&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Thank you for your response. The REST API Endpoint I am using for this request is:&lt;BR /&gt;https://&amp;lt;databricks-workspace&amp;gt;.azuredatabricks.net/api/2.0/preview/sql/alerts.&lt;/P&gt;&lt;P&gt;Please let me know if you need additional details.&lt;/P&gt;&lt;P&gt;Best regards&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jan 2025 09:06:32 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/unable-to-create-alert-using-api/m-p/107374#M42788</guid>
      <dc:creator>zg</dc:creator>
      <dc:date>2025-01-28T09:06:32Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to Create Alert Using API</title>
      <link>https://community.databricks.com/t5/data-engineering/unable-to-create-alert-using-api/m-p/107384#M42791</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/146221"&gt;@zg&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;&lt;BR /&gt;You are sending the payload related to the new endpoint (/api/2.0/sql/alerts) to the old endpoint (&lt;SPAN&gt;/api/2.0/preview/sql/alerts).&lt;BR /&gt;&lt;BR /&gt;That are the docs of the old endpoint:&lt;BR /&gt;&lt;A href="https://docs.databricks.com/api/workspace/alertslegacy/create" target="_blank"&gt;https://docs.databricks.com/api/workspace/alertslegacy/create&lt;/A&gt;&lt;BR /&gt;As you can see the field is called "name"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="filipniziol_0-1738058526972.png" style="width: 400px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/14385i77C688999CEAF59A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="filipniziol_0-1738058526972.png" alt="filipniziol_0-1738058526972.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;In the new endpoint the name is called "display_name":&lt;BR /&gt;&lt;A href="https://docs.databricks.com/api/workspace/alerts/create" target="_blank"&gt;https://docs.databricks.com/api/workspace/alerts/create&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;To sum up, just change your endpoint from&amp;nbsp;&lt;SPAN&gt;/api/2.0/preview/sql/alerts to&amp;nbsp;/api/2.0/sql/alerts and it should work.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jan 2025 10:03:12 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/unable-to-create-alert-using-api/m-p/107384#M42791</guid>
      <dc:creator>filipniziol</dc:creator>
      <dc:date>2025-01-28T10:03:12Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to Create Alert Using API</title>
      <link>https://community.databricks.com/t5/data-engineering/unable-to-create-alert-using-api/m-p/107386#M42792</link>
      <description>&lt;P&gt;You're absolutely right! Even though I had tried it before, it didn’t work initially. However, I resolved the problem by reviewing the API's structure using the UI. By following the same structure and defining a new alert condition, it worked without any errors. Here's the code I used:&lt;/P&gt;&lt;P&gt;import requests&lt;BR /&gt;import json&lt;/P&gt;&lt;P&gt;# Databricks API Details&lt;BR /&gt;HOST = "https://&amp;lt;databricks-workspace&amp;gt;.azuredatabricks.net"&lt;BR /&gt;TOKEN = "token"&lt;BR /&gt;ENDPOINT = f"{HOST}/api/2.0/sql/alerts"&lt;/P&gt;&lt;P&gt;# Function to check the alert API&lt;BR /&gt;def check_alert_api():&lt;BR /&gt;headers = {&lt;BR /&gt;"Authorization": f"Bearer {TOKEN}"&lt;BR /&gt;}&lt;BR /&gt;response = requests.get(ENDPOINT, headers=headers)&lt;BR /&gt;print("Response Data:", json.dumps(response.json(), indent=4))&lt;/P&gt;&lt;P&gt;# Execute the function&lt;BR /&gt;check_alert_api()&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jan 2025 10:30:25 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/unable-to-create-alert-using-api/m-p/107386#M42792</guid>
      <dc:creator>zg</dc:creator>
      <dc:date>2025-01-28T10:30:25Z</dc:date>
    </item>
  </channel>
</rss>

