<?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 do you disable/enable alerts via the REST API? in Alerting</title>
    <link>https://community.splunk.com/t5/Alerting/How-do-you-disable-enable-alerts-via-the-REST-API/m-p/441559#M7731</link>
    <description>&lt;P&gt;You can enable/disable rule with the API:&lt;/P&gt;

&lt;P&gt;Example with curl:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;curl -k -u admin &lt;A href="https://&amp;lt;host&amp;gt;:&amp;lt;mgmt_port&amp;gt;/servicesNS/&amp;lt;user_context&amp;gt;/&amp;lt;app_context&amp;gt;/saved/searches/&amp;lt;search&amp;gt;/disable" target="test_blank"&gt;https://&amp;lt;host&amp;gt;:&amp;lt;mgmt_port&amp;gt;/servicesNS/&amp;lt;user_context&amp;gt;/&amp;lt;app_context&amp;gt;/saved/searches/&amp;lt;search&amp;gt;/disable&lt;/A&gt; -X POST&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Replace &lt;CODE&gt;disable&lt;/CODE&gt; with &lt;CODE&gt;enable&lt;/CODE&gt; to enable.&lt;/P&gt;</description>
    <pubDate>Thu, 20 Dec 2018 16:35:48 GMT</pubDate>
    <dc:creator>damien_chillet</dc:creator>
    <dc:date>2018-12-20T16:35:48Z</dc:date>
    <item>
      <title>How do you disable/enable alerts via the REST API?</title>
      <link>https://community.splunk.com/t5/Alerting/How-do-you-disable-enable-alerts-via-the-REST-API/m-p/441558#M7730</link>
      <description>&lt;P&gt;Edit: Answer is as follows.&lt;/P&gt;

&lt;P&gt;Method: POST&lt;BR /&gt;
Endpoint: &lt;A href="https://mysplksvr:8089/servicesNS/nobody/search/saved/searches/My%20Search/%7Bvalue%7D" target="_blank"&gt;https://mysplksvr:8089/servicesNS/nobody/search/saved/searches/My%20Search/{value}&lt;/A&gt;&lt;BR /&gt;
Value: enable|disable&lt;/P&gt;

&lt;P&gt;The important point was to replace user_context with nobody. Originally, I tried my own e-mail (request was successful but didn't apply any changes).  I noticed the correct context while viewing the alert in the GUI.&lt;/P&gt;

&lt;P&gt;mysplksvr/en-US/app/search/alert?s=%2FservicesNS%2F*&lt;STRONG&gt;nobody&lt;/STRONG&gt;*%2Fsearch%2Fsaved%2Fsearches%2FMy%2520Search&lt;/P&gt;

&lt;P&gt;The recommended method of updating the GeoLite database is to stop realtime searches. This is best done via script, so I need to tell Splunk via API to stop realtime searches. That's easy, but I can't figure out how to restart those searches. It seems that if I delete the search, give it about a minute, the search restarts.&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;Is there a way to start the search manually? (I've tried dispatching it like a normal search, but it's not the same. This causes double search; the correct search has rt_scheduler appended to its URL)&lt;/LI&gt;
&lt;LI&gt;Is there a way to mimic clicking Enable/Disable when editing an Alert under &lt;A href="https://mysplksvr/en-US/app/search/alert" target="_blank"&gt;https://mysplksvr/en-US/app/search/alert&lt;/A&gt;? (this seems to start/stop the search)&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;Again, the goal is not to simply stop e-mails (or actions in general) from happening (what many of the examples from my searches suggest). I should be able to see real-time searches start/stop under Search Activity: Instance in the Monitoring Console.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 22:26:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-do-you-disable-enable-alerts-via-the-REST-API/m-p/441558#M7730</guid>
      <dc:creator>tmontney</dc:creator>
      <dc:date>2020-09-29T22:26:31Z</dc:date>
    </item>
    <item>
      <title>Re: How do you disable/enable alerts via the REST API?</title>
      <link>https://community.splunk.com/t5/Alerting/How-do-you-disable-enable-alerts-via-the-REST-API/m-p/441559#M7731</link>
      <description>&lt;P&gt;You can enable/disable rule with the API:&lt;/P&gt;

&lt;P&gt;Example with curl:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;curl -k -u admin &lt;A href="https://&amp;lt;host&amp;gt;:&amp;lt;mgmt_port&amp;gt;/servicesNS/&amp;lt;user_context&amp;gt;/&amp;lt;app_context&amp;gt;/saved/searches/&amp;lt;search&amp;gt;/disable" target="test_blank"&gt;https://&amp;lt;host&amp;gt;:&amp;lt;mgmt_port&amp;gt;/servicesNS/&amp;lt;user_context&amp;gt;/&amp;lt;app_context&amp;gt;/saved/searches/&amp;lt;search&amp;gt;/disable&lt;/A&gt; -X POST&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Replace &lt;CODE&gt;disable&lt;/CODE&gt; with &lt;CODE&gt;enable&lt;/CODE&gt; to enable.&lt;/P&gt;</description>
      <pubDate>Thu, 20 Dec 2018 16:35:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-do-you-disable-enable-alerts-via-the-REST-API/m-p/441559#M7731</guid>
      <dc:creator>damien_chillet</dc:creator>
      <dc:date>2018-12-20T16:35:48Z</dc:date>
    </item>
    <item>
      <title>Re: How do you disable/enable alerts via the REST API?</title>
      <link>https://community.splunk.com/t5/Alerting/How-do-you-disable-enable-alerts-via-the-REST-API/m-p/441560#M7732</link>
      <description>&lt;P&gt;So I expected the GUI to update when I called: &lt;A href="https://mysplksvr:8089/servicesNS/myemail%40domain.com/search/saved/searches/My%20Search/disable"&gt;https://mysplksvr:8089/servicesNS/myemail%40domain.com/search/saved/searches/My%20Search/disable&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Return data just lists info about the search. Doesn't seem to reflect the changes. user_context is the owner of the search/alert.&lt;/P&gt;</description>
      <pubDate>Thu, 20 Dec 2018 16:49:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-do-you-disable-enable-alerts-via-the-REST-API/m-p/441560#M7732</guid>
      <dc:creator>tmontney</dc:creator>
      <dc:date>2018-12-20T16:49:56Z</dc:date>
    </item>
    <item>
      <title>Re: How do you disable/enable alerts via the REST API?</title>
      <link>https://community.splunk.com/t5/Alerting/How-do-you-disable-enable-alerts-via-the-REST-API/m-p/441561#M7733</link>
      <description>&lt;P&gt;Oops, scratch that. If I replace user_context with "nobody", it works. Caught that by looking at the URL while viewing the alert in GUI (noticed it referenced nobody).&lt;/P&gt;</description>
      <pubDate>Thu, 20 Dec 2018 16:55:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-do-you-disable-enable-alerts-via-the-REST-API/m-p/441561#M7733</guid>
      <dc:creator>tmontney</dc:creator>
      <dc:date>2018-12-20T16:55:07Z</dc:date>
    </item>
    <item>
      <title>Re: How do you disable/enable alerts via the REST API?</title>
      <link>https://community.splunk.com/t5/Alerting/How-do-you-disable-enable-alerts-via-the-REST-API/m-p/441562#M7734</link>
      <description>&lt;P&gt;Great! working fine.&lt;/P&gt;</description>
      <pubDate>Tue, 02 Apr 2019 15:00:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-do-you-disable-enable-alerts-via-the-REST-API/m-p/441562#M7734</guid>
      <dc:creator>francesco_brizz</dc:creator>
      <dc:date>2019-04-02T15:00:54Z</dc:date>
    </item>
    <item>
      <title>Re: How do you disable/enable alerts via the REST API?</title>
      <link>https://community.splunk.com/t5/Alerting/How-do-you-disable-enable-alerts-via-the-REST-API/m-p/647218#M15120</link>
      <description>&lt;P&gt;I know this is five years later... but people are bound to run across this post.&lt;/P&gt;&lt;P&gt;If the saved search is &lt;STRONG&gt;shared to the app&lt;/STRONG&gt;, then the user context of your API call should be:&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;nobody&lt;/P&gt;&lt;P&gt;If you follow the instructions as written in the solution, sending a POST this way, even when an identically-named saved search exists in the App or Global context, because the POST is in the user's context, it POSTs to the user's private savedsearches.conf within the same app context, not the app's savedsearches.conf.&lt;/P&gt;&lt;P&gt;If you want to update a saved search which is shared into an app, you must change the user context to nobody when you POST. Keep in mind, you're still in servicesNS as this point. The only thing that changes is the user context.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jun 2023 21:31:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-do-you-disable-enable-alerts-via-the-REST-API/m-p/647218#M15120</guid>
      <dc:creator>brettw</dc:creator>
      <dc:date>2023-06-15T21:31:09Z</dc:date>
    </item>
  </channel>
</rss>

