<?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 How to create a simple alert using REST API in Splunk Dev</title>
    <link>https://community.splunk.com/t5/Splunk-Dev/How-to-create-a-simple-alert-using-REST-API/m-p/587118#M10430</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I am unable to create a simple alert using the following documentation.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As per documentation, the required parameters are Search and name.&lt;/P&gt;
&lt;P&gt;Following code is written in Javascript&lt;/P&gt;
&lt;P&gt;Here is my request:&lt;/P&gt;
&lt;PRE&gt;const data = {&lt;BR /&gt;  &lt;SPAN&gt;"alert_comparator"&lt;/SPAN&gt;&lt;SPAN&gt;: &lt;/SPAN&gt;&lt;SPAN&gt;"equal to"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;  &lt;SPAN&gt;"alert_threshold"&lt;/SPAN&gt;&lt;SPAN&gt;: &lt;/SPAN&gt;&lt;SPAN&gt;"0"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;  &lt;SPAN&gt;"alert_type"&lt;/SPAN&gt;&lt;SPAN&gt;: &lt;/SPAN&gt;&lt;SPAN&gt;"number of events"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;  &lt;SPAN&gt;"cron_schedule"&lt;/SPAN&gt;&lt;SPAN&gt;: &lt;/SPAN&gt;&lt;SPAN&gt;"*/1 * * * *"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;  &lt;SPAN&gt;"search"&lt;/SPAN&gt;&lt;SPAN&gt;: &lt;/SPAN&gt;&lt;SPAN&gt;"index%3D%22global-events-qa%22%20functionName%3D%22correspondence-service%22"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;  &lt;SPAN&gt;"name"&lt;/SPAN&gt;&lt;SPAN&gt;: &lt;/SPAN&gt;&lt;SPAN&gt;"Simple alert"&lt;BR /&gt;&lt;/SPAN&gt;}&lt;BR /&gt;&lt;SPAN&gt;const &lt;/SPAN&gt;response = &lt;SPAN&gt;await &lt;/SPAN&gt;axios.&lt;SPAN&gt;post&lt;/SPAN&gt;(&lt;SPAN&gt;' https://app.splunkcloud.com:8089/services/saved/searches'&lt;/SPAN&gt;&lt;SPAN&gt;,  &lt;/SPAN&gt;data&lt;SPAN&gt;,&lt;/SPAN&gt;{&lt;BR /&gt;    &lt;SPAN&gt;headers&lt;/SPAN&gt;: { ...(&lt;SPAN&gt;await &lt;/SPAN&gt;&lt;SPAN&gt;getAuth&lt;/SPAN&gt;({&lt;SPAN&gt;region&lt;/SPAN&gt;: &lt;SPAN&gt;'ap-southeast-2'&lt;/SPAN&gt;}))}&lt;BR /&gt;})&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/PRE&gt;
&lt;P&gt;Here is the error:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cannot perform action "POST" without a target name to act on.&lt;/P&gt;
&lt;P&gt;Documentation Link: &lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/RESTREF/RESTsearch?_ga=2.62077416.557388192.1646109950-663789425.1628561939#saved.2Fsearches" target="_blank" rel="noopener"&gt;https://docs.splunk.com/Documentation/Splunk/latest/RESTREF/RESTsearch?_ga=2.62077416.557388192.1646109950-663789425.1628561939#saved.2Fsearches&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;It will be really great if you could share some working examples somewhere in your documentation.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks in advance!&lt;/P&gt;</description>
    <pubDate>Wed, 02 Mar 2022 17:39:01 GMT</pubDate>
    <dc:creator>Manware</dc:creator>
    <dc:date>2022-03-02T17:39:01Z</dc:date>
    <item>
      <title>How to create a simple alert using REST API</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-to-create-a-simple-alert-using-REST-API/m-p/587118#M10430</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I am unable to create a simple alert using the following documentation.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As per documentation, the required parameters are Search and name.&lt;/P&gt;
&lt;P&gt;Following code is written in Javascript&lt;/P&gt;
&lt;P&gt;Here is my request:&lt;/P&gt;
&lt;PRE&gt;const data = {&lt;BR /&gt;  &lt;SPAN&gt;"alert_comparator"&lt;/SPAN&gt;&lt;SPAN&gt;: &lt;/SPAN&gt;&lt;SPAN&gt;"equal to"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;  &lt;SPAN&gt;"alert_threshold"&lt;/SPAN&gt;&lt;SPAN&gt;: &lt;/SPAN&gt;&lt;SPAN&gt;"0"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;  &lt;SPAN&gt;"alert_type"&lt;/SPAN&gt;&lt;SPAN&gt;: &lt;/SPAN&gt;&lt;SPAN&gt;"number of events"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;  &lt;SPAN&gt;"cron_schedule"&lt;/SPAN&gt;&lt;SPAN&gt;: &lt;/SPAN&gt;&lt;SPAN&gt;"*/1 * * * *"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;  &lt;SPAN&gt;"search"&lt;/SPAN&gt;&lt;SPAN&gt;: &lt;/SPAN&gt;&lt;SPAN&gt;"index%3D%22global-events-qa%22%20functionName%3D%22correspondence-service%22"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;  &lt;SPAN&gt;"name"&lt;/SPAN&gt;&lt;SPAN&gt;: &lt;/SPAN&gt;&lt;SPAN&gt;"Simple alert"&lt;BR /&gt;&lt;/SPAN&gt;}&lt;BR /&gt;&lt;SPAN&gt;const &lt;/SPAN&gt;response = &lt;SPAN&gt;await &lt;/SPAN&gt;axios.&lt;SPAN&gt;post&lt;/SPAN&gt;(&lt;SPAN&gt;' https://app.splunkcloud.com:8089/services/saved/searches'&lt;/SPAN&gt;&lt;SPAN&gt;,  &lt;/SPAN&gt;data&lt;SPAN&gt;,&lt;/SPAN&gt;{&lt;BR /&gt;    &lt;SPAN&gt;headers&lt;/SPAN&gt;: { ...(&lt;SPAN&gt;await &lt;/SPAN&gt;&lt;SPAN&gt;getAuth&lt;/SPAN&gt;({&lt;SPAN&gt;region&lt;/SPAN&gt;: &lt;SPAN&gt;'ap-southeast-2'&lt;/SPAN&gt;}))}&lt;BR /&gt;})&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/PRE&gt;
&lt;P&gt;Here is the error:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cannot perform action "POST" without a target name to act on.&lt;/P&gt;
&lt;P&gt;Documentation Link: &lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/RESTREF/RESTsearch?_ga=2.62077416.557388192.1646109950-663789425.1628561939#saved.2Fsearches" target="_blank" rel="noopener"&gt;https://docs.splunk.com/Documentation/Splunk/latest/RESTREF/RESTsearch?_ga=2.62077416.557388192.1646109950-663789425.1628561939#saved.2Fsearches&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;It will be really great if you could share some working examples somewhere in your documentation.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks in advance!&lt;/P&gt;</description>
      <pubDate>Wed, 02 Mar 2022 17:39:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-to-create-a-simple-alert-using-REST-API/m-p/587118#M10430</guid>
      <dc:creator>Manware</dc:creator>
      <dc:date>2022-03-02T17:39:01Z</dc:date>
    </item>
    <item>
      <title>Re: create a simple alert using REST API</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-to-create-a-simple-alert-using-REST-API/m-p/587239#M10431</link>
      <description>&lt;P&gt;The linked documentation does have examples.&amp;nbsp; Click on the [Expand] link then scroll past the argument tables to find the examples.&lt;/P&gt;&lt;P&gt;The example for creating a search uses a name without spaces.&amp;nbsp; I wonder if that will make a difference.&lt;/P&gt;</description>
      <pubDate>Wed, 02 Mar 2022 14:19:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-to-create-a-simple-alert-using-REST-API/m-p/587239#M10431</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2022-03-02T14:19:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a simple alert using REST API</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-to-create-a-simple-alert-using-REST-API/m-p/587356#M10432</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/213957"&gt;@richgalloway&lt;/a&gt;&amp;nbsp;. I saw that example before. that's curl + XML. I was looking for an example with a json format.&amp;nbsp;&lt;/P&gt;&lt;P&gt;After fiddling with it for some time, I came to know that the 'data' in above request has to be url encoded. then it worked fine.&lt;/P&gt;&lt;P&gt;cheers&lt;/P&gt;</description>
      <pubDate>Thu, 03 Mar 2022 05:46:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-to-create-a-simple-alert-using-REST-API/m-p/587356#M10432</guid>
      <dc:creator>Manware</dc:creator>
      <dc:date>2022-03-03T05:46:27Z</dc:date>
    </item>
  </channel>
</rss>

