<?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: Render Dashboard to PDF with time range - REST API in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/Render-Dashboard-to-PDF-with-time-range-REST-API/m-p/702355#M57606</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/49493"&gt;@tscroggins&lt;/a&gt;&amp;nbsp;,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your reply, then do you perhaps know if they're any time-range args that work with input-dashboard ? Otherwise, should i use another method ?&lt;/P&gt;</description>
    <pubDate>Mon, 21 Oct 2024 07:16:29 GMT</pubDate>
    <dc:creator>Ethil</dc:creator>
    <dc:date>2024-10-21T07:16:29Z</dc:date>
    <item>
      <title>Render Dashboard to PDF with time range - REST API</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Render-Dashboard-to-PDF-with-time-range-REST-API/m-p/702146#M57585</link>
      <description>&lt;P&gt;Hello everyone, and thanks in advance for your help. I'm very new to this subject so if anything is unclear, i'll try to explain my problem more in details.&lt;/P&gt;&lt;P&gt;I'm using spunk 9.2.1, and i'm trying to generate a &lt;STRONG&gt;PDF&lt;/STRONG&gt; from one of my &lt;STRONG&gt;dashboard&lt;/STRONG&gt; on the &lt;STRONG&gt;last 24 hours&lt;/STRONG&gt;, using a &lt;STRONG&gt;splunk API&lt;/STRONG&gt; call.&lt;/P&gt;&lt;P&gt;I'm using a POST request to the ".../services/pdfgen/render" endpoint. First I couldn't find any documentation on&amp;nbsp; this matter. Furthermore, even when looking at&amp;nbsp;&lt;SPAN&gt;$SPLUNK_HOME/lib/python3.7/sites-packages/splunk/pdf/pdfgen_*.py&amp;nbsp; (endpoint,views,search,utils) i could'nt really understand what arguments to use to ask for the last 24 hours data. I know it should be possible because it is doable on the splunk GUI, where you can choose a time range and render according to it.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I saw something looking like time range args : et and lt, which should be earliest time and latest time, but i don't know what type of time data it is expecting an trying random things didn't get me anywhere.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;If you know anything on this subject please help me &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;thank you&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Oct 2024 07:58:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Render-Dashboard-to-PDF-with-time-range-REST-API/m-p/702146#M57585</guid>
      <dc:creator>Ethil</dc:creator>
      <dc:date>2024-10-17T07:58:52Z</dc:date>
    </item>
    <item>
      <title>Re: Render Dashboard to PDF with time range - REST API</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Render-Dashboard-to-PDF-with-time-range-REST-API/m-p/702332#M57604</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/270941"&gt;@Ethil&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;As far as I can tell, the et and lt query parameters are only used with&amp;nbsp;input-search and not input-dashboard etc.&lt;/P&gt;</description>
      <pubDate>Sun, 20 Oct 2024 20:56:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Render-Dashboard-to-PDF-with-time-range-REST-API/m-p/702332#M57604</guid>
      <dc:creator>tscroggins</dc:creator>
      <dc:date>2024-10-20T20:56:45Z</dc:date>
    </item>
    <item>
      <title>Re: Render Dashboard to PDF with time range - REST API</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Render-Dashboard-to-PDF-with-time-range-REST-API/m-p/702355#M57606</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/49493"&gt;@tscroggins&lt;/a&gt;&amp;nbsp;,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your reply, then do you perhaps know if they're any time-range args that work with input-dashboard ? Otherwise, should i use another method ?&lt;/P&gt;</description>
      <pubDate>Mon, 21 Oct 2024 07:16:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Render-Dashboard-to-PDF-with-time-range-REST-API/m-p/702355#M57606</guid>
      <dc:creator>Ethil</dc:creator>
      <dc:date>2024-10-21T07:16:29Z</dc:date>
    </item>
    <item>
      <title>Re: Render Dashboard to PDF with time range - REST API</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Render-Dashboard-to-PDF-with-time-range-REST-API/m-p/703405#M57657</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/270941"&gt;@Ethil&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;To include time values from form inputs, SplunkWeb sends a rendered version of the dashboard XML to the pdfgen service.&lt;/P&gt;&lt;P&gt;For example, given the Simple XML source:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;form version="1.1" theme="light"&amp;gt;
  &amp;lt;label&amp;gt;my_dashboard&amp;lt;/label&amp;gt;
  &amp;lt;fieldset submitButton="false"&amp;gt;
    &amp;lt;input type="time" token="time_tok"&amp;gt;
      &amp;lt;label&amp;gt;&amp;lt;/label&amp;gt;
      &amp;lt;default&amp;gt;
        &amp;lt;earliest&amp;gt;-24h@h&amp;lt;/earliest&amp;gt;
        &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
      &amp;lt;/default&amp;gt;
    &amp;lt;/input&amp;gt;
  &amp;lt;/fieldset&amp;gt;
  &amp;lt;row&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;table&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;| makeresults
| addinfo&amp;lt;/query&amp;gt;
          &amp;lt;earliest&amp;gt;$time_tok.earliest$&amp;lt;/earliest&amp;gt;
          &amp;lt;latest&amp;gt;$time_tok.latest$&amp;lt;/latest&amp;gt;
        &amp;lt;/search&amp;gt;
        &amp;lt;option name="drilldown"&amp;gt;none&amp;lt;/option&amp;gt;
        &amp;lt;option name="refresh.display"&amp;gt;progressbar&amp;lt;/option&amp;gt;
      &amp;lt;/table&amp;gt;
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;
&amp;lt;/form&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;View the dashboard in SplunkWeb and change the time range to Earliest: -1h@h and Latest: @h.&lt;/P&gt;&lt;P&gt;When you export the dashboard to PDF, SplunkWeb renders the following static dashboard:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;dashboard&amp;gt;
  &amp;lt;label&amp;gt;my_dashboard&amp;lt;/label&amp;gt;
  &amp;lt;row&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;table&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;| makeresults
| addinfo&amp;lt;/query&amp;gt;
          &amp;lt;earliest&amp;gt;-1h@h&amp;lt;/earliest&amp;gt;
          &amp;lt;latest&amp;gt;@h&amp;lt;/latest&amp;gt;
        &amp;lt;/search&amp;gt;
        &amp;lt;option name="drilldown"&amp;gt;none&amp;lt;/option&amp;gt;
        &amp;lt;option name="refresh.display"&amp;gt;progressbar&amp;lt;/option&amp;gt;
      &amp;lt;/table&amp;gt;
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;
&amp;lt;/dashboard&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;Note that the form element is now a dashboard element, the fieldset element has been removed, and the time_tok.earliest and time_tok.latest token values have been propagated to the search earliest and latest elements.&lt;/P&gt;&lt;P&gt;The dashboard is then XML-encoded:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;&amp;amp;lt;dashboard&amp;amp;gt;
  &amp;amp;lt;label&amp;amp;gt;my_dashboard&amp;amp;lt;/label&amp;amp;gt;
  &amp;amp;lt;row&amp;amp;gt;
    &amp;amp;lt;panel&amp;amp;gt;
      &amp;amp;lt;table&amp;amp;gt;
        &amp;amp;lt;search&amp;amp;gt;
          &amp;amp;lt;query&amp;amp;gt;| makeresults
| addinfo&amp;amp;lt;/query&amp;amp;gt;
          &amp;amp;lt;earliest&amp;amp;gt;-1h@h&amp;amp;lt;/earliest&amp;amp;gt;
          &amp;amp;lt;latest&amp;amp;gt;@h&amp;amp;lt;/latest&amp;amp;gt;
        &amp;amp;lt;/search&amp;amp;gt;
        &amp;amp;lt;option name="drilldown"&amp;amp;gt;none&amp;amp;lt;/option&amp;amp;gt;
        &amp;amp;lt;option name="refresh.display"&amp;amp;gt;progressbar&amp;amp;lt;/option&amp;amp;gt;
      &amp;amp;lt;/table&amp;amp;gt;
    &amp;amp;lt;/panel&amp;amp;gt;
  &amp;amp;lt;/row&amp;amp;gt;
&amp;amp;lt;/dashboard&amp;amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;Finally, the result is sent to the pdfgen service using the URL-encoded input-dashboard-xml parameter, illustrated here using curl over the management port (SplunkWeb uses a SplunkWeb endpoint) with line breaks removed:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;curl -k -u admin -o my_dashboard_last_hour.pdf https://localhost:8089/services/pdfgen/render --data-urlencode 'input-dashboard-xml=&amp;amp;lt;dashboard&amp;amp;gt;&amp;amp;lt;label&amp;amp;gt;my_dashboard&amp;amp;lt;/label&amp;amp;gt;&amp;amp;lt;row&amp;amp;gt;&amp;amp;lt;panel&amp;amp;gt;&amp;amp;lt;table&amp;amp;gt;&amp;amp;lt;search&amp;amp;gt;&amp;amp;lt;query&amp;amp;gt;| makeresults | addinfo&amp;amp;lt;/query&amp;amp;gt;&amp;amp;lt;earliest&amp;amp;gt;-1h@h&amp;amp;lt;/earliest&amp;amp;gt;&amp;amp;lt;latest&amp;amp;gt;@h&amp;amp;lt;/latest&amp;amp;gt;&amp;amp;lt;/search&amp;amp;gt;&amp;amp;lt;option name="drilldown"&amp;amp;gt;none&amp;amp;lt;/option&amp;amp;gt;&amp;amp;lt;option name="refresh.display"&amp;amp;gt;progressbar&amp;amp;lt;/option&amp;amp;gt;&amp;amp;lt;/table&amp;amp;gt;&amp;amp;lt;/panel&amp;amp;gt;&amp;amp;lt;/row&amp;amp;gt;&amp;amp;lt;/dashboard&amp;amp;gt;'&lt;/LI-CODE&gt;&lt;P&gt;You can pass any static Simple XML to the pdfgen service; it doesn't need to be associated with a saved dashboard:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;curl -k -u admin -o hello.pdf https://localhost:8089/services/pdfgen/render --data-urlencode 'input-dashboard-xml=&amp;amp;lt;dashboard&amp;amp;gt;&amp;amp;lt;label&amp;amp;gt;Hello, World!&amp;amp;lt;/label&amp;amp;gt;&amp;amp;lt;/dashboard&amp;amp;gt;'&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 02 Nov 2024 16:23:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Render-Dashboard-to-PDF-with-time-range-REST-API/m-p/703405#M57657</guid>
      <dc:creator>tscroggins</dc:creator>
      <dc:date>2024-11-02T16:23:44Z</dc:date>
    </item>
    <item>
      <title>Re: Render Dashboard to PDF with time range - REST API</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Render-Dashboard-to-PDF-with-time-range-REST-API/m-p/704487#M57729</link>
      <description>&lt;P&gt;Thanks a lot for your help !&lt;/P&gt;</description>
      <pubDate>Fri, 15 Nov 2024 08:46:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Render-Dashboard-to-PDF-with-time-range-REST-API/m-p/704487#M57729</guid>
      <dc:creator>Ethil</dc:creator>
      <dc:date>2024-11-15T08:46:41Z</dc:date>
    </item>
  </channel>
</rss>

