<?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: REST API - &amp;quot;GET&amp;quot; SavedSearches gets confused? 🙄 in Splunk Enterprise</title>
    <link>https://community.splunk.com/t5/Splunk-Enterprise/REST-API-quot-GET-quot-SavedSearches-gets-confused/m-p/706120#M20987</link>
    <description>&lt;P&gt;Ahhhhhhhhhhh, here we go!!! It takes also the "sharing=global" objects &lt;span class="lia-unicode-emoji" title=":face_with_rolling_eyes:"&gt;🙄&lt;/span&gt;i understand.&lt;BR /&gt;Are there more parameters to filter directly from the GET? I can't read them in Documentation 🤷‍&lt;span class="lia-unicode-emoji" title=":female_sign:"&gt;♀️&lt;/span&gt;&lt;BR /&gt;(also the "&lt;EM&gt;?count=x&lt;/EM&gt;" is not documented &lt;span class="lia-unicode-emoji" title=":thinking_face:"&gt;🤔&lt;/span&gt;)&lt;BR /&gt;Thanks.&lt;/P&gt;</description>
    <pubDate>Fri, 06 Dec 2024 09:20:16 GMT</pubDate>
    <dc:creator>verbal_666</dc:creator>
    <dc:date>2024-12-06T09:20:16Z</dc:date>
    <item>
      <title>REST API - "GET" SavedSearches gets confused? 🙄</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/REST-API-quot-GET-quot-SavedSearches-gets-confused/m-p/706096#M20978</link>
      <description>&lt;P&gt;Hello.&lt;BR /&gt;I'm getting trouble listing all my SavedSearches from a SHC, using a command line REST API get.&lt;/P&gt;&lt;P&gt;I'm asking Splunk to list all savedsearches of user "admin" in "MYAPP" app.&lt;/P&gt;&lt;P&gt;For some strange reason, i can't locate, list gets also some other apps &lt;span class="lia-unicode-emoji" title=":face_with_rolling_eyes:"&gt;🙄&lt;/span&gt;&lt;span class="lia-unicode-emoji" title=":face_with_rolling_eyes:"&gt;🙄&lt;/span&gt;&lt;span class="lia-unicode-emoji" title=":face_with_rolling_eyes:"&gt;🙄&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Here we are,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;curl -skL -u 'usr:pwd' 'https://SHC_NODE:8089/servicesNS/admin/MYAPP/saved/searches?count=-1' | egrep 'name="app"' | sort -u&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;... and here what it came from,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;s:key name="app"&amp;gt;MYAPP&amp;lt;/s:key&amp;gt;
&amp;lt;s:key name="app"&amp;gt;MYAPP_backup&amp;lt;/s:key&amp;gt;
&amp;lt;s:key name="app"&amp;gt;ANOTHER_APP&amp;lt;/s:key&amp;gt;
&amp;lt;s:key name="app"&amp;gt;search&amp;lt;/s:key&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I expect only "&lt;FONT face="arial black,avant garde" size="1 2 3 4 5 6 7"&gt;&amp;lt;s:key name="app"&amp;gt;MYAPP&amp;lt;/s:key&amp;gt;&lt;/FONT&gt;" entries, or not?&lt;BR /&gt;What's wrong??? &lt;span class="lia-unicode-emoji" title=":smirking_face:"&gt;😏&lt;/span&gt;&lt;span class="lia-unicode-emoji" title=":smirking_face:"&gt;😏&lt;/span&gt;&lt;span class="lia-unicode-emoji" title=":smirking_face:"&gt;😏&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;Linux OS&lt;BR /&gt;SPLUNK ENTERPRISE 8.2.12&lt;BR /&gt;SHC 3 Nodes (all nodes reponses the same output)&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Dec 2024 07:21:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/REST-API-quot-GET-quot-SavedSearches-gets-confused/m-p/706096#M20978</guid>
      <dc:creator>verbal_666</dc:creator>
      <dc:date>2024-12-06T07:21:18Z</dc:date>
    </item>
    <item>
      <title>Re: REST API - "GET" SavedSearches gets confused? 🙄</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/REST-API-quot-GET-quot-SavedSearches-gets-confused/m-p/706105#M20982</link>
      <description>&lt;P&gt;The REST API gives you also globally shared searches back.&lt;/P&gt;&lt;P&gt;You could try:&lt;/P&gt;&lt;P&gt;1.&amp;nbsp; filter out all searches with name="sharing"&amp;gt;global&amp;lt;&lt;/P&gt;&lt;P&gt;2. filter for name="app"&amp;gt;MYAPP&amp;lt;&lt;/P&gt;&lt;P&gt;3. use a different user to call the api&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Dec 2024 08:10:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/REST-API-quot-GET-quot-SavedSearches-gets-confused/m-p/706105#M20982</guid>
      <dc:creator>PaulPanther</dc:creator>
      <dc:date>2024-12-06T08:10:37Z</dc:date>
    </item>
    <item>
      <title>Re: REST API - "GET" SavedSearches gets confused? 🙄</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/REST-API-quot-GET-quot-SavedSearches-gets-confused/m-p/706117#M20985</link>
      <description>&lt;P&gt;Nope. You're mistaking two different things.&lt;/P&gt;&lt;P&gt;One is where the search is defined. Another is where it is visible.&lt;/P&gt;&lt;P&gt;By calling /servicesNS/admin/myapp you're getting a list of apps _visible_ in context of user admin and app myapp. It might as well be defined in another app and shared globally.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Dec 2024 09:16:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/REST-API-quot-GET-quot-SavedSearches-gets-confused/m-p/706117#M20985</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2024-12-06T09:16:42Z</dc:date>
    </item>
    <item>
      <title>Re: REST API - "GET" SavedSearches gets confused? 🙄</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/REST-API-quot-GET-quot-SavedSearches-gets-confused/m-p/706120#M20987</link>
      <description>&lt;P&gt;Ahhhhhhhhhhh, here we go!!! It takes also the "sharing=global" objects &lt;span class="lia-unicode-emoji" title=":face_with_rolling_eyes:"&gt;🙄&lt;/span&gt;i understand.&lt;BR /&gt;Are there more parameters to filter directly from the GET? I can't read them in Documentation 🤷‍&lt;span class="lia-unicode-emoji" title=":female_sign:"&gt;♀️&lt;/span&gt;&lt;BR /&gt;(also the "&lt;EM&gt;?count=x&lt;/EM&gt;" is not documented &lt;span class="lia-unicode-emoji" title=":thinking_face:"&gt;🤔&lt;/span&gt;)&lt;BR /&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Dec 2024 09:20:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/REST-API-quot-GET-quot-SavedSearches-gets-confused/m-p/706120#M20987</guid>
      <dc:creator>verbal_666</dc:creator>
      <dc:date>2024-12-06T09:20:16Z</dc:date>
    </item>
    <item>
      <title>Re: REST API - "GET" SavedSearches gets confused? 🙄</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/REST-API-quot-GET-quot-SavedSearches-gets-confused/m-p/706122#M20988</link>
      <description>&lt;P&gt;The count parameter seems to be a general parameter recognized by all (?) GET endpoints. It's indeed not explicitly documented although it's hinted here &lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/RESTUM/RESTusing" target="_blank" rel="noopener"&gt;https://docs.splunk.com/Documentation/Splunk/latest/RESTUM/RESTusing&lt;/A&gt;&lt;/P&gt;&lt;P&gt;And I don't think you can filter in the REST call itself. You have to get all results and postprocess them yourself - the eai:appName should contain the name of the app the search is defined in.&lt;/P&gt;&lt;P&gt;(and I always use /servicesNS/-/-/ and just filter afterwards).&lt;/P&gt;</description>
      <pubDate>Fri, 06 Dec 2024 09:31:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/REST-API-quot-GET-quot-SavedSearches-gets-confused/m-p/706122#M20988</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2024-12-06T09:31:53Z</dc:date>
    </item>
    <item>
      <title>Re: REST API - "GET" SavedSearches gets confused? 🙄</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/REST-API-quot-GET-quot-SavedSearches-gets-confused/m-p/706123#M20989</link>
      <description>&lt;P&gt;Just a beginning for shell... with script parameters (user and app in variables), i'm close enough to what i'm seeking &lt;span class="lia-unicode-emoji" title=":grinning_face:"&gt;😀&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;curl -skL -u 'usr:pwd' 'https://SHC_NODE:8089/servicesNS/admin/MYAPP/saved/searches?count=-1' | egrep '&amp;lt;title&amp;gt;|name="app"&amp;gt;|name="sharing"&amp;gt;|name="owner"&amp;gt;|name="disabled"&amp;gt;' | grep -v '&amp;lt;title&amp;gt;savedsearch&amp;lt;/title&amp;gt;' | sed -n -e '/title/,+4p' | paste - - - - - | grep 'MYAPP' | grep 'title' | sed 's/ //g ; s/\t//g'&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Perhaps not perfect, yet... but close &lt;span class="lia-unicode-emoji" title=":grinning_face:"&gt;😀&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Dec 2024 10:53:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/REST-API-quot-GET-quot-SavedSearches-gets-confused/m-p/706123#M20989</guid>
      <dc:creator>verbal_666</dc:creator>
      <dc:date>2024-12-06T10:53:42Z</dc:date>
    </item>
    <item>
      <title>Re: REST API - "GET" SavedSearches gets confused? 🙄</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/REST-API-quot-GET-quot-SavedSearches-gets-confused/m-p/706127#M20990</link>
      <description>&lt;P&gt;One hint - while Splunk returns XML by default, it might be easier to use -d output_mode=json with your curl and use the json output - there are more easier available tools for manipulating json in shell than for XML.&lt;/P&gt;&lt;P&gt;So you can "easily" do something like this:&lt;/P&gt;&lt;PRE&gt;curl -k -u admin:pass https://splunksh:8089/servicesNS/-/-/saved/searches -d output_mode=json -d count=0 --get | jq '.entry | map(.) | .[] | {name: .name, app: .acl.app}' &lt;/PRE&gt;&lt;P&gt;or even&lt;/P&gt;&lt;PRE&gt;curl -k -u admin:pass https://splunksh:8089/servicesNS/-/-/saved/searches -d output_mode=json -d count=0 --get | jq '.entry | map(.) | .[] | .acl.app + ":" + .name' &lt;/PRE&gt;&lt;P&gt;&amp;nbsp;(the jq tool is fairly easily available in modern distros while xmlint or similar stuff might not be).&lt;/P&gt;</description>
      <pubDate>Fri, 06 Dec 2024 11:01:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/REST-API-quot-GET-quot-SavedSearches-gets-confused/m-p/706127#M20990</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2024-12-06T11:01:57Z</dc:date>
    </item>
    <item>
      <title>Re: REST API - "GET" SavedSearches gets confused? 🙄</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/REST-API-quot-GET-quot-SavedSearches-gets-confused/m-p/706131#M20991</link>
      <description>&lt;P&gt;Great &lt;span class="lia-unicode-emoji" title=":clapping_hands:"&gt;👏&lt;/span&gt;&lt;span class="lia-unicode-emoji" title=":clapping_hands:"&gt;👏&lt;/span&gt;&lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Effectively XML is quite obsolete &lt;span class="lia-unicode-emoji" title=":sleeping_face:"&gt;😴&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Thanks again &lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Dec 2024 11:18:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/REST-API-quot-GET-quot-SavedSearches-gets-confused/m-p/706131#M20991</guid>
      <dc:creator>verbal_666</dc:creator>
      <dc:date>2024-12-06T11:18:43Z</dc:date>
    </item>
    <item>
      <title>Re: REST API - "GET" SavedSearches gets confused? 🙄</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/REST-API-quot-GET-quot-SavedSearches-gets-confused/m-p/706165#M20997</link>
      <description>&lt;P&gt;Final version... obviously inside a script or an interactive menu with parameters should work fine &lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;curl -skL -u 'usr:pwd' 'https://SHC_NODE:8089/servicesNS/-/-/saved/searches' --get -d 'output_mode=json' -d 'count=0' | jq -r ' .entry[] | select(.acl.app == "MYAPP" and .acl.owner == "MYUSER") | .name + " : " + .acl.app + " : " + .author + " : " + .acl.owner + " : " + .acl.sharing + " : " + (.content.disabled|tostring) '&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Alternative,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;curl -skL -u 'usr:pwd' 'https://SHC_NODE:8089/servicesNS/-/-/saved/searches' --get -d 'output_mode=json' -d 'count=0' | jq -r ' .entry[] | select(.acl.app == "MYAPP" and .acl.owner == "MYUSER") | [.name,.acl.app,.author,.acl.owner,.acl.sharing,.content.disabled] | @csv '&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks all &lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 07 Dec 2024 03:42:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/REST-API-quot-GET-quot-SavedSearches-gets-confused/m-p/706165#M20997</guid>
      <dc:creator>verbal_666</dc:creator>
      <dc:date>2024-12-07T03:42:24Z</dc:date>
    </item>
  </channel>
</rss>

