<?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 create new MACRO using Rest api? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-to-create-new-MACRO-using-Rest-api/m-p/363023#M66159</link>
    <description>&lt;P&gt;Thanks for that it is helpfull , &lt;BR /&gt;
i already tried &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  import splunklib.client as client
 service = client.connect(username="admin", password="changeme", host="myhost", app="search")
service.delete('properties/macros/name')
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But it only does disable the macro but not delete it fully,&lt;BR /&gt;
is there any function that apply that ? &lt;/P&gt;</description>
    <pubDate>Fri, 09 Feb 2018 09:28:28 GMT</pubDate>
    <dc:creator>jadengoho</dc:creator>
    <dc:date>2018-02-09T09:28:28Z</dc:date>
    <item>
      <title>How to create new MACRO using Rest api?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-create-new-MACRO-using-Rest-api/m-p/363021#M66157</link>
      <description>&lt;P&gt;As of now i follow this code  and it works perfectly :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  from splunklib.client import connect
  service = connect(username="admin", password="changeme", host="myhost", app="search")
  service.post('properties/macros/test', definition="test123")
  print service.get('properties/macros/test/definition')["body"]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I see it here &lt;A href="https://answers.splunk.com/answers/223843/rest-endpoint-for-modifying-applocalmacrosconf.html"&gt;https://answers.splunk.com/answers/223843/rest-endpoint-for-modifying-applocalmacrosconf.html&lt;/A&gt;&lt;BR /&gt;
 But that code was to update ,&lt;/P&gt;

&lt;P&gt;What if i want to add or delete a macro using the code ?&lt;/P&gt;</description>
      <pubDate>Fri, 09 Feb 2018 08:10:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-create-new-MACRO-using-Rest-api/m-p/363021#M66157</guid>
      <dc:creator>jadengoho</dc:creator>
      <dc:date>2018-02-09T08:10:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to create new MACRO using Rest api?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-create-new-MACRO-using-Rest-api/m-p/363022#M66158</link>
      <description>&lt;P&gt;Hi @jadenhoho,&lt;/P&gt;

&lt;P&gt;To create macro using Rest API, you can achieve like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;import splunklib.client as client
service = client.connect(username="admin", password="changeme", host="myhost", app="search")
service.post('properties/macros', __stanza="test")
service.post('properties/macros/test', definition="test123")
print service.get('properties/macros/test/definition')["body"]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I don't have idea about delete one.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Feb 2018 08:56:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-create-new-MACRO-using-Rest-api/m-p/363022#M66158</guid>
      <dc:creator>harsmarvania57</dc:creator>
      <dc:date>2018-02-09T08:56:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to create new MACRO using Rest api?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-create-new-MACRO-using-Rest-api/m-p/363023#M66159</link>
      <description>&lt;P&gt;Thanks for that it is helpfull , &lt;BR /&gt;
i already tried &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  import splunklib.client as client
 service = client.connect(username="admin", password="changeme", host="myhost", app="search")
service.delete('properties/macros/name')
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But it only does disable the macro but not delete it fully,&lt;BR /&gt;
is there any function that apply that ? &lt;/P&gt;</description>
      <pubDate>Fri, 09 Feb 2018 09:28:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-create-new-MACRO-using-Rest-api/m-p/363023#M66159</guid>
      <dc:creator>jadengoho</dc:creator>
      <dc:date>2018-02-09T09:28:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to create new MACRO using Rest api?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-create-new-MACRO-using-Rest-api/m-p/363024#M66160</link>
      <description>&lt;P&gt;This one worked for me for deleting macro using REST API&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;import splunklib.client as client
service = client.connect(username="admin", password="changeme", host="myhost", app="search")
service.delete('/servicesNS/nobody/search/admin/macros/test')
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 09 Feb 2018 10:29:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-create-new-MACRO-using-Rest-api/m-p/363024#M66160</guid>
      <dc:creator>harsmarvania57</dc:creator>
      <dc:date>2018-02-09T10:29:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to create new MACRO using Rest api?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-create-new-MACRO-using-Rest-api/m-p/363025#M66161</link>
      <description>&lt;P&gt;Thank you very much this code really help &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Feb 2018 00:21:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-create-new-MACRO-using-Rest-api/m-p/363025#M66161</guid>
      <dc:creator>jadengoho</dc:creator>
      <dc:date>2018-02-12T00:21:37Z</dc:date>
    </item>
  </channel>
</rss>

