<?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 REST API Python example in Splunk Dev</title>
    <link>https://community.splunk.com/t5/Splunk-Dev/REST-API-Python-example/m-p/160961#M2178</link>
    <description>&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.1/RESTAPI/RESTsearches"&gt;http://docs.splunk.com/Documentation/Splunk/6.1/RESTAPI/RESTsearches&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;I am testing out this script and it works with a few modifications on the endpoints I changed.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;/services/search/jobs','POST'
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I changed the endpoint to:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;/services/search/jobs/%s/results' % (sid),'GET'
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;My results are great, but they appear in xml format. Would I have to add "output_mode=csv" in the body argument?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;body=urllib.urlencode({'search': searchQuery}))[1]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 12 May 2014 20:32:18 GMT</pubDate>
    <dc:creator>bleung93</dc:creator>
    <dc:date>2014-05-12T20:32:18Z</dc:date>
    <item>
      <title>REST API Python example</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/REST-API-Python-example/m-p/160961#M2178</link>
      <description>&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.1/RESTAPI/RESTsearches"&gt;http://docs.splunk.com/Documentation/Splunk/6.1/RESTAPI/RESTsearches&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;I am testing out this script and it works with a few modifications on the endpoints I changed.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;/services/search/jobs','POST'
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I changed the endpoint to:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;/services/search/jobs/%s/results' % (sid),'GET'
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;My results are great, but they appear in xml format. Would I have to add "output_mode=csv" in the body argument?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;body=urllib.urlencode({'search': searchQuery}))[1]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 12 May 2014 20:32:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/REST-API-Python-example/m-p/160961#M2178</guid>
      <dc:creator>bleung93</dc:creator>
      <dc:date>2014-05-12T20:32:18Z</dc:date>
    </item>
    <item>
      <title>Re: REST API Python example</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/REST-API-Python-example/m-p/160962#M2179</link>
      <description>&lt;P&gt;print httplib2.Http(disable_ssl_certificate_validation=True).request(base url +&lt;BR /&gt;
        + '/services/search/jobs/%s/results' % (sid),'GET', headers={'Authorization': 'Splunk %s'&lt;BR /&gt;
        % sessionKey}, body=urllib.urlencode({'search': searchQuery}))[1]&lt;/P&gt;

&lt;P&gt;The above will print out what this curl command would print out.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;curl --get -k -u admin:splunker -d "count=100" https://localhost:8089/servicesNS/admin/search/search/jobs/1399938078.2/results
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Where would I add content such as "output_mode=csv", that way the results being printed are user-friendly and easily readable?&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 16:35:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/REST-API-Python-example/m-p/160962#M2179</guid>
      <dc:creator>bleung93</dc:creator>
      <dc:date>2020-09-28T16:35:15Z</dc:date>
    </item>
    <item>
      <title>Re: REST API Python example</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/REST-API-Python-example/m-p/160963#M2180</link>
      <description>&lt;P&gt;There is an example here :&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/RESTAPI/RESTsearch#GET_search.2Fjobs.2F.7Bsearch_id.7D.2Fresults" target="_blank"&gt;http://docs.splunk.com/Documentation/Splunk/6.1.1/RESTAPI/RESTsearch#GET_search.2Fjobs.2F.7Bsearch_id.7D.2Fresults&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Have you considered using the &lt;A href="http://dev.splunk.com/view/python-sdk/SP-CAAAEBB" target="_blank"&gt;Splunk Python SDK&lt;/A&gt; , it makes what you are trying to do a lot simpler.&lt;/P&gt;

&lt;P&gt;Some examples :&lt;/P&gt;

&lt;P&gt;&lt;A href="http://dev.splunk.com/view/python-sdk/SP-CAAAER5" target="_blank"&gt;http://dev.splunk.com/view/python-sdk/SP-CAAAER5&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 16:35:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/REST-API-Python-example/m-p/160963#M2180</guid>
      <dc:creator>Damien_Dallimor</dc:creator>
      <dc:date>2020-09-28T16:35:37Z</dc:date>
    </item>
  </channel>
</rss>

