<?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 disable an ITSI service using REST API in Splunk ITSI</title>
    <link>https://community.splunk.com/t5/Splunk-ITSI/How-to-disable-an-ITSI-service-using-REST-API/m-p/494789#M1966</link>
    <description>&lt;P&gt;Happy to help!  &lt;/P&gt;

&lt;P&gt;Please let me know if you develop any more use cases.  I like to keep track of how my apps are being used. &lt;/P&gt;

&lt;P&gt;Thanks in advance!&lt;/P&gt;</description>
    <pubDate>Sat, 14 Mar 2020 22:21:59 GMT</pubDate>
    <dc:creator>jkat54</dc:creator>
    <dc:date>2020-03-14T22:21:59Z</dc:date>
    <item>
      <title>How to disable an ITSI service using REST API</title>
      <link>https://community.splunk.com/t5/Splunk-ITSI/How-to-disable-an-ITSI-service-using-REST-API/m-p/494785#M1962</link>
      <description>&lt;P&gt;Using the WebTools App from Splunkbase, I've issued the following API calls to modify the 'Service' object attribute 'Enabled' to 0.  I get a 200 response but the targeted service remains enabled.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Examples of the API calls issued:&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval header="{\"Content-type\":\"application/json\"}"
| eval data="{\"Enabled\": 0}"
| curl method=post uri=https://localhost:8089/servicesNS/nobody/SA-ITOA/itoa_interface/service/dc3b486e-2ec5-4f09-9dab-3714fc5f536f/?is_partial_data=1 splunkauth=true debug=true headerfield=header datafield=data

| eval header="{\"Content-type\":\"application/json\"}"
| eval data="Enabled=0"
| curl method=post uri=https://localhost:8089/servicesNS/nobody/SA-ITOA/itoa_interface/service/dc3b486e-2ec5-4f09-9dab-3714fc5f536f/?is_partial_data=1 splunkauth=true debug=true headerfield=header datafield=data
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;To confirm the ITSI service 'enabled' state, I issue the following GET query:&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval header="{\"Content-Type\":\"application/json\"}"
| curl method=get uri=https://localhost:8089/servicesNS/nobody/SA-ITOA/itoa_interface/service/dc3b486e-2ec5-4f09-9dab-3714fc5f536f splunkauth=true debug=true headerfield=header
| spath input=curl_message
| fields key object_type enabled permissions.user mod_source mod_timestamp
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;Output:&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;The mod_source and mod_timestamp coincide with my API 'disable' attempt.&lt;/P&gt;

&lt;P&gt;&lt;IMG src="https://community.splunk.com/storage/temp/287590-11mar2020-api-confirmingquery.png" alt="alt text" /&gt;&lt;/P&gt;

&lt;P&gt;I appreciate any guidance or corrections.  Thank you!&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 04:37:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-ITSI/How-to-disable-an-ITSI-service-using-REST-API/m-p/494785#M1962</guid>
      <dc:creator>damianokuen</dc:creator>
      <dc:date>2020-09-30T04:37:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to disable an ITSI service using REST API</title>
      <link>https://community.splunk.com/t5/Splunk-ITSI/How-to-disable-an-ITSI-service-using-REST-API/m-p/494786#M1963</link>
      <description>&lt;P&gt;Have you tried using a software proxy like teleriks fiddler to see what happens in the POST when you click disable in the UI?&lt;/P&gt;</description>
      <pubDate>Wed, 11 Mar 2020 20:04:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-ITSI/How-to-disable-an-ITSI-service-using-REST-API/m-p/494786#M1963</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2020-03-11T20:04:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to disable an ITSI service using REST API</title>
      <link>https://community.splunk.com/t5/Splunk-ITSI/How-to-disable-an-ITSI-service-using-REST-API/m-p/494787#M1964</link>
      <description>&lt;P&gt;I have not, thank you for the suggestion;  I will give it a try.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Mar 2020 13:44:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-ITSI/How-to-disable-an-ITSI-service-using-REST-API/m-p/494787#M1964</guid>
      <dc:creator>damianokuen</dc:creator>
      <dc:date>2020-03-12T13:44:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to disable an ITSI service using REST API</title>
      <link>https://community.splunk.com/t5/Splunk-ITSI/How-to-disable-an-ITSI-service-using-REST-API/m-p/494788#M1965</link>
      <description>&lt;P&gt;A grateful shout out to my awesome Splunk Sales Manager, who connected me to the right ITOA support and Michael Bentley who developed this great app,"Webtools Add-on" &lt;A href="https://splunkbase.splunk.com/app/4146/#/details" target="_blank"&gt;https://splunkbase.splunk.com/app/4146/#/details&lt;/A&gt;, available on Splunkbase.  I appreciate Michael actively supports this app and responded quickly to my email with guidance. &lt;/P&gt;

&lt;P&gt;Solution:&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;First, generate and stream a single result to properly eval the 'data' field for use in my curl command &lt;/LI&gt;
&lt;LI&gt;Second, I need to add the &lt;STRONG&gt;_key&lt;/STRONG&gt; field to my API POST command payload; the _key is the ITSI 'serviceid' value&lt;/LI&gt;
&lt;LI&gt;Third, the ITSI REST API 'service' object's attribute &lt;STRONG&gt;is all lower case&lt;/STRONG&gt;, 'enabled' vs. errant 'Enabled' described in the ITSI REST API Schema documentation  &lt;A href="https://docs.splunk.com/Documentation/ITSI/4.4.2/RESTAPI/ITSIRESTAPIschema#Service" target="_blank"&gt;https://docs.splunk.com/Documentation/ITSI/4.4.2/RESTAPI/ITSIRESTAPIschema#Service&lt;/A&gt;,&lt;/LI&gt;
&lt;LI&gt;Finally, remove the &lt;STRONG&gt;"/" (forward slash)&lt;/STRONG&gt; at the end of the uri, &lt;STRONG&gt;between the serviceid and ?is_partial_data=1&lt;/STRONG&gt;&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;Putting it all together, these steps solved my problem and I can enable and disable ITSI services using the REST API interface:&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Step 1&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;index=_internal &lt;BR /&gt;
| head 1&lt;/P&gt;

&lt;HR /&gt;

&lt;P&gt;&lt;STRONG&gt;Step 2 and 3&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;| eval header="{\"content-type\":\"application/json\"}"&lt;BR /&gt;
| eval data="{\"&lt;STRONG&gt;enabled&lt;/STRONG&gt;\": 0,&lt;STRONG&gt;\"_key\":\"dc3b486e-2ec5-4f09-9dab-3714fc5f536f\"&lt;/STRONG&gt;}"&lt;/P&gt;

&lt;HR /&gt;

&lt;P&gt;&lt;STRONG&gt;Step 4&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;/service/dc3b486e-2ec5-4f09-9dab-3714fc5f53 '&lt;STRONG&gt;6f?is&lt;/STRONG&gt;' _partial_data=1&lt;/P&gt;

&lt;P&gt;| curl method=post uri=&lt;A href="https://localhost:8089/servicesNS/nobody/SA-ITOA/itoa_interface/service/dc3b486e-2ec5-4f09-9dab-3714fc5f536f?is_partial_data=1" target="_blank"&gt;https://localhost:8089/servicesNS/nobody/SA-ITOA/itoa_interface/service/dc3b486e-2ec5-4f09-9dab-3714fc5f536f?is_partial_data=1&lt;/A&gt; splunkauth=true debug=true headerfield=header datafield=data&lt;/P&gt;

&lt;HR /&gt;

&lt;P&gt;&lt;STRONG&gt;Example of a functional SPL query to disable an ITSI service (change the value to 1 in eval of 'data' to enable an ITSI service):&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;index=_internal &lt;BR /&gt;
| head 1&lt;BR /&gt;
| eval header="{\"content-type\":\"application/json\"}"&lt;BR /&gt;
| eval data="{\"enabled\": 0,\"_key\":\"dc3b486e-2ec5-4f09-9dab-3714fc5f536f\"}"&lt;BR /&gt;
| curl method=post uri=&lt;A href="https://localhost:8089/servicesNS/nobody/SA-ITOA/itoa_interface/service/dc3b486e-2ec5-4f09-9dab-3714fc5f536f?is_partial_data=1" target="_blank"&gt;https://localhost:8089/servicesNS/nobody/SA-ITOA/itoa_interface/service/dc3b486e-2ec5-4f09-9dab-3714fc5f536f?is_partial_data=1&lt;/A&gt; splunkauth=true debug=true headerfield=header datafield=data&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 04:34:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-ITSI/How-to-disable-an-ITSI-service-using-REST-API/m-p/494788#M1965</guid>
      <dc:creator>damianokuen</dc:creator>
      <dc:date>2020-09-30T04:34:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to disable an ITSI service using REST API</title>
      <link>https://community.splunk.com/t5/Splunk-ITSI/How-to-disable-an-ITSI-service-using-REST-API/m-p/494789#M1966</link>
      <description>&lt;P&gt;Happy to help!  &lt;/P&gt;

&lt;P&gt;Please let me know if you develop any more use cases.  I like to keep track of how my apps are being used. &lt;/P&gt;

&lt;P&gt;Thanks in advance!&lt;/P&gt;</description>
      <pubDate>Sat, 14 Mar 2020 22:21:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-ITSI/How-to-disable-an-ITSI-service-using-REST-API/m-p/494789#M1966</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2020-03-14T22:21:59Z</dc:date>
    </item>
  </channel>
</rss>

