<?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: What are Splunk's REST API capabilities around use for report generation? in Reporting</title>
    <link>https://community.splunk.com/t5/Reporting/What-are-Splunk-s-REST-API-capabilities-around-use-for-report/m-p/195598#M4239</link>
    <description>&lt;P&gt;Hi @ronak&lt;/P&gt;

&lt;P&gt;Please be sure that when responding to someone's answer from here on out, click on "Add comment" directly below their answer or, if responding to someone's comment, type in the "Add your comment..." box directly below their comment. You typed your response in the "Enter your answer here..." box at the very bottom of the page which, instead, posts a brand new answer when it was really meant as a comment. This will help with a clean continuous flow of the conversation. &lt;/P&gt;

&lt;P&gt;I can't convert your current "answer" to a comment under martin_mueller's answer because of the character count being too large. If your response is hitting a character count limit, just be sure to break it up into multiple comments. Thanks and happy Splunking!&lt;/P&gt;

&lt;P&gt;Patrick&lt;/P&gt;</description>
    <pubDate>Mon, 19 Jan 2015 20:56:09 GMT</pubDate>
    <dc:creator>ppablo</dc:creator>
    <dc:date>2015-01-19T20:56:09Z</dc:date>
    <item>
      <title>What are Splunk's REST API capabilities around use for report generation?</title>
      <link>https://community.splunk.com/t5/Reporting/What-are-Splunk-s-REST-API-capabilities-around-use-for-report/m-p/195595#M4236</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;

&lt;P&gt;I'm trying to understand whether using REST APIs , can I - &lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;Execute searches on raw index, data models and summaries ?&lt;/LI&gt;
&lt;LI&gt;Execute searches as user_1 (who has assigned role of role_1) such that the results are returned per security/access model&lt;/LI&gt;
&lt;LI&gt;Get the results without limit (e.g. in some aspects of Splunk, I've read about not being able to return more than n number of records)...&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;My goal is - &lt;/P&gt;

&lt;P&gt;a. Use a programming language wrapper using programming language wrapper and REST API&lt;BR /&gt;
b. manipulate/summarize the data in required format&lt;BR /&gt;
c. use external charting library&lt;BR /&gt;
d. generate the reports/visualizations&lt;BR /&gt;
e. schedule this script and run as various user(s) to get relevant data&lt;/P&gt;

&lt;P&gt;Any pointers would be great. &lt;/P&gt;

&lt;P&gt;thanks, ronak&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 18:41:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/What-are-Splunk-s-REST-API-capabilities-around-use-for-report/m-p/195595#M4236</guid>
      <dc:creator>ronak</dc:creator>
      <dc:date>2020-09-28T18:41:53Z</dc:date>
    </item>
    <item>
      <title>Re: What are Splunk's REST API capabilities around use for report generation?</title>
      <link>https://community.splunk.com/t5/Reporting/What-are-Splunk-s-REST-API-capabilities-around-use-for-report/m-p/195596#M4237</link>
      <description>&lt;P&gt;Here's a tutorial on how to run searches using the REST API: &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.2.1/RESTTUT/RESTsearches"&gt;http://docs.splunk.com/Documentation/Splunk/6.2.1/RESTTUT/RESTsearches&lt;/A&gt;&lt;BR /&gt;
Those searches will be run as whatever user you used to log in, respecting the user's namespace.&lt;/P&gt;

&lt;P&gt;Do consider using one of the Splunk SDKs at &lt;A href="http://dev.splunk.com/view/sdks/SP-CAAADP7"&gt;http://dev.splunk.com/view/sdks/SP-CAAADP7&lt;/A&gt; instead of calling the REST API yourself, should save you a lot of work on standard tasks such as running searches and getting the results.&lt;/P&gt;</description>
      <pubDate>Sun, 18 Jan 2015 19:58:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/What-are-Splunk-s-REST-API-capabilities-around-use-for-report/m-p/195596#M4237</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2015-01-18T19:58:11Z</dc:date>
    </item>
    <item>
      <title>Re: What are Splunk's REST API capabilities around use for report generation?</title>
      <link>https://community.splunk.com/t5/Reporting/What-are-Splunk-s-REST-API-capabilities-around-use-for-report/m-p/195597#M4238</link>
      <description>&lt;P&gt;Hi Martin&lt;/P&gt;

&lt;P&gt;Below is the script that got from the link and associated result ..made it work for my environment..&lt;/P&gt;

&lt;P&gt;I was expecting to see 10 rows (as I see when I execute the same thru Search bar in browser). &lt;/P&gt;

&lt;P&gt;Am I doing something wrong here?&lt;/P&gt;

&lt;P&gt;thanks, ronak&lt;BR /&gt;
---------------------- result --------------------&lt;/P&gt;

&lt;P&gt;Ronaks-MacBook-Air:bin root# python rb9.py&lt;BR /&gt;
search index=* | head 10&lt;BR /&gt;
({'status': '201', 'content-length': '90', 'x-content-type-options': 'nosniff', 'expires': 'Thu, 26 Oct 1978 00:00:00 GMT', 'vary': 'Authorization', 'server': 'Splunkd', 'connection': 'Close', 'location': '/services/search/jobs/1421682152.110', 'cache-control': 'no-store, no-cache, must-revalidate, max-age=0', 'date': 'Mon, 19 Jan 2015 15:42:32 GMT', 'x-frame-options': 'SAMEORIGIN', 'content-type': 'text/xml; charset=UTF-8'}, '\n\n  1421682152.110\n\n')&lt;/P&gt;

&lt;P&gt;---------------------- script --------------------&lt;/P&gt;

&lt;H1&gt;!/usr/bin/python -u&lt;/H1&gt;

&lt;P&gt;import urllib&lt;BR /&gt;
import httplib2&lt;BR /&gt;
from xml.dom import minidom&lt;/P&gt;

&lt;P&gt;baseurl = '&lt;A href="https://localhost:8089" target="_blank"&gt;https://localhost:8089&lt;/A&gt;'&lt;BR /&gt;
userName = 'admin'&lt;BR /&gt;
password = 'admin'&lt;/P&gt;

&lt;P&gt;searchQuery = 'index=* | head 10'&lt;/P&gt;

&lt;H6&gt;Authenticate with server.&lt;/H6&gt;

&lt;H1&gt;####  Disable SSL cert validation. Splunk certs are self-signed.&lt;/H1&gt;

&lt;P&gt;serverContent = httplib2.Http(disable_ssl_certificate_validation=True).request(baseurl + '/services/auth/login',&lt;BR /&gt;
    'POST', headers={}, body=urllib.urlencode({'username':userName, 'password':password}))[1]&lt;/P&gt;

&lt;P&gt;sessionKey = minidom.parseString(serverContent).getElementsByTagName('sessionKey')[0].childNodes[0].nodeValue&lt;/P&gt;

&lt;H1&gt;check if the query has the search operator&lt;/H1&gt;

&lt;P&gt;if not searchQuery.startswith('search'):&lt;BR /&gt;
    searchQuery = 'search ' + searchQuery&lt;/P&gt;

&lt;P&gt;print searchQuery&lt;/P&gt;

&lt;H1&gt;Run the search.&lt;/H1&gt;

&lt;H1&gt;Again, disable SSL cert validation.&lt;/H1&gt;

&lt;P&gt;print httplib2.Http(disable_ssl_certificate_validation=True).request(baseurl + '/services/search/jobs','POST',&lt;/P&gt;

&lt;H2&gt;    headers={'Authorization': 'Splunk %s' % sessionKey},body=urllib.urlencode({'search': searchQuery}))&lt;/H2&gt;</description>
      <pubDate>Mon, 28 Sep 2020 18:42:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/What-are-Splunk-s-REST-API-capabilities-around-use-for-report/m-p/195597#M4238</guid>
      <dc:creator>ronak</dc:creator>
      <dc:date>2020-09-28T18:42:01Z</dc:date>
    </item>
    <item>
      <title>Re: What are Splunk's REST API capabilities around use for report generation?</title>
      <link>https://community.splunk.com/t5/Reporting/What-are-Splunk-s-REST-API-capabilities-around-use-for-report/m-p/195598#M4239</link>
      <description>&lt;P&gt;Hi @ronak&lt;/P&gt;

&lt;P&gt;Please be sure that when responding to someone's answer from here on out, click on "Add comment" directly below their answer or, if responding to someone's comment, type in the "Add your comment..." box directly below their comment. You typed your response in the "Enter your answer here..." box at the very bottom of the page which, instead, posts a brand new answer when it was really meant as a comment. This will help with a clean continuous flow of the conversation. &lt;/P&gt;

&lt;P&gt;I can't convert your current "answer" to a comment under martin_mueller's answer because of the character count being too large. If your response is hitting a character count limit, just be sure to break it up into multiple comments. Thanks and happy Splunking!&lt;/P&gt;

&lt;P&gt;Patrick&lt;/P&gt;</description>
      <pubDate>Mon, 19 Jan 2015 20:56:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/What-are-Splunk-s-REST-API-capabilities-around-use-for-report/m-p/195598#M4239</guid>
      <dc:creator>ppablo</dc:creator>
      <dc:date>2015-01-19T20:56:09Z</dc:date>
    </item>
    <item>
      <title>Re: What are Splunk's REST API capabilities around use for report generation?</title>
      <link>https://community.splunk.com/t5/Reporting/What-are-Splunk-s-REST-API-capabilities-around-use-for-report/m-p/195599#M4240</link>
      <description>&lt;P&gt;The response you received points you to the job that has been created for your search (jobid &lt;CODE&gt;1421682152.110&lt;/CODE&gt;). You can query the job as to whether it has finished, whether there's a preview already available, what the eventual search results are, and so on.&lt;/P&gt;</description>
      <pubDate>Tue, 20 Jan 2015 07:45:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/What-are-Splunk-s-REST-API-capabilities-around-use-for-report/m-p/195599#M4240</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2015-01-20T07:45:04Z</dc:date>
    </item>
  </channel>
</rss>

