<?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: Exporting reports using the REST API in Other Usage</title>
    <link>https://community.splunk.com/t5/Other-Usage/How-to-export-reports-using-the-REST-API/m-p/640363#M474</link>
    <description>&lt;P&gt;There isn't one.&amp;nbsp; Search results can be exported in CSV format, but not other output.&lt;/P&gt;</description>
    <pubDate>Tue, 18 Apr 2023 14:48:52 GMT</pubDate>
    <dc:creator>richgalloway</dc:creator>
    <dc:date>2023-04-18T14:48:52Z</dc:date>
    <item>
      <title>How to export reports using the REST API?</title>
      <link>https://community.splunk.com/t5/Other-Usage/How-to-export-reports-using-the-REST-API/m-p/640348#M471</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I`m looking to export a scheduled report using the REST API but I`m struggling with the syntax.&lt;/P&gt;
&lt;P&gt;I was able to run a new search inside "curl" and export it, but can`t seem to be able to do the same for saved reports.&lt;/P&gt;
&lt;P&gt;Would be grateful if someone could help with the syntax for exporting the following report as a CSV file:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;curl -k -H "Authorization: Bearer myValidToken" https://myValidDomain.splunkcloud.com:8089/servicesNS/userName/app/saved/searches/%20Test%20/history&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Apr 2023 15:48:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Other-Usage/How-to-export-reports-using-the-REST-API/m-p/640348#M471</guid>
      <dc:creator>tomapatan</dc:creator>
      <dc:date>2023-04-18T15:48:21Z</dc:date>
    </item>
    <item>
      <title>Re: Exporting reports using the REST API</title>
      <link>https://community.splunk.com/t5/Other-Usage/How-to-export-reports-using-the-REST-API/m-p/640351#M472</link>
      <description>&lt;P&gt;The &lt;FONT face="courier new,courier"&gt;saved/searches/&amp;lt;foo&amp;gt;/history&lt;/FONT&gt; endpoint does not have an option for returning the response as a CSV.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Apr 2023 13:16:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Other-Usage/How-to-export-reports-using-the-REST-API/m-p/640351#M472</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2023-04-18T13:16:42Z</dc:date>
    </item>
    <item>
      <title>Re: Exporting reports using the REST API</title>
      <link>https://community.splunk.com/t5/Other-Usage/How-to-export-reports-using-the-REST-API/m-p/640354#M473</link>
      <description>&lt;P&gt;Hi Rich,&lt;/P&gt;&lt;P&gt;I guess my question is what is the correct endpoint and what is the correct syntax for exporting the report as a CSV file ?&lt;/P&gt;&lt;P&gt;I`ve looked at the "&lt;SPAN&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/9.0.4/RESTREF/RESTsearch#search.2Fv2.2Fjobs.2F.7Bsearch_id.7D.2Fresults_preview" target="_self"&gt;REST API Reference Manual&lt;/A&gt;", but couldn't&amp;nbsp;really find my answer.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Many thanks.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Apr 2023 13:26:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Other-Usage/How-to-export-reports-using-the-REST-API/m-p/640354#M473</guid>
      <dc:creator>tomapatan</dc:creator>
      <dc:date>2023-04-18T13:26:26Z</dc:date>
    </item>
    <item>
      <title>Re: Exporting reports using the REST API</title>
      <link>https://community.splunk.com/t5/Other-Usage/How-to-export-reports-using-the-REST-API/m-p/640363#M474</link>
      <description>&lt;P&gt;There isn't one.&amp;nbsp; Search results can be exported in CSV format, but not other output.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Apr 2023 14:48:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Other-Usage/How-to-export-reports-using-the-REST-API/m-p/640363#M474</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2023-04-18T14:48:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to export reports using the REST API?</title>
      <link>https://community.splunk.com/t5/Other-Usage/How-to-export-reports-using-the-REST-API/m-p/640406#M475</link>
      <description>&lt;P&gt;Here is a simple bash script:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;#!/bin/bash&lt;BR /&gt;# A simple bash script example of how to get notable events details from REST API&lt;BR /&gt;# Author = Gregg Woodcock &amp;lt;Woodcock@Splunxter.com&amp;gt;&lt;/P&gt;&lt;P&gt;USERID="admin"&lt;BR /&gt;PASSWORD="YOUR_PASSWORD_HERE"&lt;BR /&gt;HOST="YOUR_HOST_HERE"&lt;/P&gt;&lt;P&gt;# EXECUTE search and retrieve SID&lt;BR /&gt;SID=$(curl -u ${USERID}:${PASSWORD} \&lt;BR /&gt;-k https://${HOST}:8089/services/search/jobs \&lt;BR /&gt;-d search='| `es_notable_events`' \&lt;BR /&gt;| grep "sid" | awk -F\&amp;gt; '{print $2}' | awk -F\&amp;lt; '{print $1}')&lt;BR /&gt;echo "SID=${SID}"&lt;/P&gt;&lt;P&gt;# WAIT for search to finish&lt;BR /&gt;isDone=0&lt;BR /&gt;until [ ${isDone} -eq 1 ]; do&lt;BR /&gt;# WAIT for search to finish (this should be a test loop with a timeout)&lt;BR /&gt;echo "Wating..."&lt;BR /&gt;sleep 2&lt;BR /&gt;isDone=$(curl -u ${USERID}:${PASSWORD} \&lt;BR /&gt;-k https://${HOST}:8089/services/search/jobs/${SID} \&lt;BR /&gt;| grep 's:key name="isDone"' | awk -F\&amp;gt; '{print $2}' | awk -F\&amp;lt; '{print $1}')&lt;BR /&gt;echo "isDone=${isDone}"&lt;BR /&gt;done&lt;/P&gt;&lt;P&gt;# RETRIEVE the search results (now that job isDone)&lt;BR /&gt;curl -u ${USERID}:${PASSWORD} \&lt;BR /&gt;-k https://${HOST}:8089/services/search/jobs/${SID}/results/ \&lt;BR /&gt;--get -d output_mode=csv&lt;/P&gt;&lt;P&gt;# This endpoint returns results only when your search has completed.&lt;BR /&gt;# You can also get output from the events endpoint&lt;BR /&gt;# located at /search/jobs/{search_id}/events/&lt;BR /&gt;# while your search is still running.&lt;BR /&gt;# For complete search results, use the results endpoint.&lt;/P&gt;&lt;P&gt;# You can return search results in JSON, CSV or XML&lt;BR /&gt;# by setting the output_mode parameter.&lt;BR /&gt;# By default, results are returned in XML format.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Apr 2023 18:30:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Other-Usage/How-to-export-reports-using-the-REST-API/m-p/640406#M475</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2023-04-18T18:30:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to export reports using the REST API?</title>
      <link>https://community.splunk.com/t5/Other-Usage/How-to-export-reports-using-the-REST-API/m-p/640617#M476</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/249836"&gt;@tomapatan&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Have you tried something like:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;curl -k -u admin:password https://splunkcloud.com:8089/servicesNS/-/-/search/v2/jobs/export -d search="| savedsearch Test" -d output_mode=csv&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;Let me know if that works on Splunk Cloud.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Apr 2023 14:37:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Other-Usage/How-to-export-reports-using-the-REST-API/m-p/640617#M476</guid>
      <dc:creator>joao_amorim</dc:creator>
      <dc:date>2023-04-19T14:37:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to export reports using the REST API?</title>
      <link>https://community.splunk.com/t5/Other-Usage/How-to-export-reports-using-the-REST-API/m-p/640768#M477</link>
      <description>&lt;P&gt;Unfortunately it doesn`t work. I`m getting&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Error in 'savedsearch' command: Unable to find saved search named 'Test'&lt;/LI-CODE&gt;&lt;P&gt;Although the report definitely exists and is scheduled to run.&lt;/P&gt;</description>
      <pubDate>Thu, 20 Apr 2023 08:12:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Other-Usage/How-to-export-reports-using-the-REST-API/m-p/640768#M477</guid>
      <dc:creator>tomapatan</dc:creator>
      <dc:date>2023-04-20T08:12:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to export reports using the REST API?</title>
      <link>https://community.splunk.com/t5/Other-Usage/How-to-export-reports-using-the-REST-API/m-p/640779#M478</link>
      <description>&lt;P&gt;Please ignore my previous answer, the report was set to private and this does in fact work.&lt;BR /&gt;I had to add the "-o" (output) flag and specify where the file should go to as I didn`t know what the default location was.&lt;/P&gt;</description>
      <pubDate>Thu, 20 Apr 2023 09:06:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Other-Usage/How-to-export-reports-using-the-REST-API/m-p/640779#M478</guid>
      <dc:creator>tomapatan</dc:creator>
      <dc:date>2023-04-20T09:06:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to export reports using the REST API?</title>
      <link>https://community.splunk.com/t5/Other-Usage/How-to-export-reports-using-the-REST-API/m-p/640781#M479</link>
      <description>&lt;P&gt;Hi Gregg,&lt;/P&gt;&lt;P&gt;This is amazing, thanks for sharing, wish I could mark more than one answer as a solution.&lt;BR /&gt;&lt;A class="" href="https://community.splunk.com/t5/user/viewprofilepage/user-id/206497" target="_self"&gt;&lt;SPAN class=""&gt;joao_amorim&lt;/SPAN&gt;&lt;/A&gt;&amp;nbsp;answer was addressing my basic question, but I can see how I can expand on the REST API topic using your solution.&lt;/P&gt;&lt;P&gt;Many thanks,&lt;/P&gt;&lt;P&gt;Toma&lt;/P&gt;</description>
      <pubDate>Thu, 20 Apr 2023 09:13:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Other-Usage/How-to-export-reports-using-the-REST-API/m-p/640781#M479</guid>
      <dc:creator>tomapatan</dc:creator>
      <dc:date>2023-04-20T09:13:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to export reports using the REST API?</title>
      <link>https://community.splunk.com/t5/Other-Usage/How-to-export-reports-using-the-REST-API/m-p/640790#M480</link>
      <description>&lt;P&gt;How would I get this working for reports with a longer name format, for example:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[REPORT] This is a test report&lt;/LI-CODE&gt;&lt;P&gt;I`ve tried to URL encode the characters without success:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;%5BREPORT%5D%20This%20is%20a%20test%20report&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Apr 2023 09:40:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Other-Usage/How-to-export-reports-using-the-REST-API/m-p/640790#M480</guid>
      <dc:creator>tomapatan</dc:creator>
      <dc:date>2023-04-20T09:40:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to export reports using the REST API?</title>
      <link>https://community.splunk.com/t5/Other-Usage/How-to-export-reports-using-the-REST-API/m-p/640860#M481</link>
      <description>&lt;P&gt;There is always the Karma button...&lt;/P&gt;</description>
      <pubDate>Thu, 20 Apr 2023 16:07:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Other-Usage/How-to-export-reports-using-the-REST-API/m-p/640860#M481</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2023-04-20T16:07:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to export reports using the REST API?</title>
      <link>https://community.splunk.com/t5/Other-Usage/How-to-export-reports-using-the-REST-API/m-p/642003#M482</link>
      <description>&lt;P&gt;Try something like:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;... search="| savedsearch 'This is a test report'"....&lt;/LI-CODE&gt;&lt;P&gt;Or the other way around:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;... search='| savedsearch "This is a test resport"' ...&lt;/LI-CODE&gt;&lt;P&gt;One of those should work.&lt;/P&gt;</description>
      <pubDate>Tue, 02 May 2023 13:47:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Other-Usage/How-to-export-reports-using-the-REST-API/m-p/642003#M482</guid>
      <dc:creator>joao_amorim</dc:creator>
      <dc:date>2023-05-02T13:47:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to export reports using the REST API?</title>
      <link>https://community.splunk.com/t5/Other-Usage/How-to-export-reports-using-the-REST-API/m-p/649890#M483</link>
      <description>&lt;P&gt;A simple bash script to do what?&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jul 2023 18:16:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Other-Usage/How-to-export-reports-using-the-REST-API/m-p/649890#M483</guid>
      <dc:creator>gerrysr6</dc:creator>
      <dc:date>2023-07-10T18:16:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to export reports using the REST API?</title>
      <link>https://community.splunk.com/t5/Other-Usage/How-to-export-reports-using-the-REST-API/m-p/649909#M484</link>
      <description>&lt;P&gt;To exercise the rest endpoint in its most basic use.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jul 2023 22:52:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Other-Usage/How-to-export-reports-using-the-REST-API/m-p/649909#M484</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2023-07-10T22:52:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to export reports using the REST API?</title>
      <link>https://community.splunk.com/t5/Other-Usage/How-to-export-reports-using-the-REST-API/m-p/668814#M1619</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/1406"&gt;@woodcock&lt;/a&gt;&amp;nbsp;What is the best way to modify this script to support the API token approach?&amp;nbsp; I have tried a few different versions, but am unable to get it to work properly.&lt;/P&gt;&lt;P&gt;So....something like:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;curl -H "Authorization: Bearer eyJraWQiOiJzcGx1bmsuc2......."&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Nov 2023 04:46:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Other-Usage/How-to-export-reports-using-the-REST-API/m-p/668814#M1619</guid>
      <dc:creator>qcjacobo2577</dc:creator>
      <dc:date>2023-11-16T04:46:44Z</dc:date>
    </item>
  </channel>
</rss>

