<?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 how to create dashboard/view using splunk java sdk? in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/how-to-create-dashboard-view-using-splunk-java-sdk/m-p/258844#M16279</link>
    <description>&lt;P&gt;I tried a lot but couldn’t figure out the way to CREATE DASHBOARDS using splunk SDK.&lt;BR /&gt;
Here is the snapshot of the code I tried. Can someone please help me in code to create dashboards using splunk sdk.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;            JobArgs jobargs = new JobArgs();
    jobargs.put("name", "TestAutomation1");
    jobargs.put("eai:data", "&amp;lt;dashboard&amp;gt;&amp;lt;label&amp;gt;the_Automation_new_label&amp;lt;/label&amp;gt;&amp;lt;/dashboard&amp;gt;");
    jobargs.put("eai:type", "views");
    jobargs.put("eai:userName", "admin");
    jobargs.put("isDashboard", true);
    jobargs.put("isVisible", true);
    jobargs.put("label", "the_Automation_new_label");
    jobargs.put("rootNode", "dashboard");

            HttpService httpService = new HttpService(splunk_host);
    ResponseMessage response = httpService.post("/servicesNS/admin/search/data/ui/views/_new",jobargs);
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;When i run this code, it always ends up as 401--unauthorized exception. I am establish connection prior to this code which executes perfectly. Am i doing it right? Can some one please help me to create dashboards/views using java sdk. Thank you!&lt;/P&gt;</description>
    <pubDate>Tue, 01 Dec 2015 08:48:09 GMT</pubDate>
    <dc:creator>ranjithjosephd</dc:creator>
    <dc:date>2015-12-01T08:48:09Z</dc:date>
    <item>
      <title>how to create dashboard/view using splunk java sdk?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/how-to-create-dashboard-view-using-splunk-java-sdk/m-p/258844#M16279</link>
      <description>&lt;P&gt;I tried a lot but couldn’t figure out the way to CREATE DASHBOARDS using splunk SDK.&lt;BR /&gt;
Here is the snapshot of the code I tried. Can someone please help me in code to create dashboards using splunk sdk.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;            JobArgs jobargs = new JobArgs();
    jobargs.put("name", "TestAutomation1");
    jobargs.put("eai:data", "&amp;lt;dashboard&amp;gt;&amp;lt;label&amp;gt;the_Automation_new_label&amp;lt;/label&amp;gt;&amp;lt;/dashboard&amp;gt;");
    jobargs.put("eai:type", "views");
    jobargs.put("eai:userName", "admin");
    jobargs.put("isDashboard", true);
    jobargs.put("isVisible", true);
    jobargs.put("label", "the_Automation_new_label");
    jobargs.put("rootNode", "dashboard");

            HttpService httpService = new HttpService(splunk_host);
    ResponseMessage response = httpService.post("/servicesNS/admin/search/data/ui/views/_new",jobargs);
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;When i run this code, it always ends up as 401--unauthorized exception. I am establish connection prior to this code which executes perfectly. Am i doing it right? Can some one please help me to create dashboards/views using java sdk. Thank you!&lt;/P&gt;</description>
      <pubDate>Tue, 01 Dec 2015 08:48:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/how-to-create-dashboard-view-using-splunk-java-sdk/m-p/258844#M16279</guid>
      <dc:creator>ranjithjosephd</dc:creator>
      <dc:date>2015-12-01T08:48:09Z</dc:date>
    </item>
    <item>
      <title>Re: how to create dashboard/view using splunk java sdk?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/how-to-create-dashboard-view-using-splunk-java-sdk/m-p/258845#M16280</link>
      <description>&lt;P&gt;I could crack this. Now using splunk sdk i could create dashboards as well!!&lt;/P&gt;</description>
      <pubDate>Wed, 02 Dec 2015 06:01:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/how-to-create-dashboard-view-using-splunk-java-sdk/m-p/258845#M16280</guid>
      <dc:creator>ranjithjosephd</dc:creator>
      <dc:date>2015-12-02T06:01:08Z</dc:date>
    </item>
    <item>
      <title>Re: how to create dashboard/view using splunk java sdk?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/how-to-create-dashboard-view-using-splunk-java-sdk/m-p/258846#M16281</link>
      <description>&lt;P&gt;What was the solution ?&lt;/P&gt;</description>
      <pubDate>Tue, 11 Oct 2016 14:51:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/how-to-create-dashboard-view-using-splunk-java-sdk/m-p/258846#M16281</guid>
      <dc:creator>TMazurek</dc:creator>
      <dc:date>2016-10-11T14:51:34Z</dc:date>
    </item>
    <item>
      <title>Re: how to create dashboard/view using splunk java sdk?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/how-to-create-dashboard-view-using-splunk-java-sdk/m-p/258847#M16282</link>
      <description>&lt;P&gt;any update on this, how can we create a dashboard&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jan 2018 14:12:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/how-to-create-dashboard-view-using-splunk-java-sdk/m-p/258847#M16282</guid>
      <dc:creator>srinivasup</dc:creator>
      <dc:date>2018-01-23T14:12:06Z</dc:date>
    </item>
    <item>
      <title>Re: how to create dashboard/view using splunk java sdk?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/how-to-create-dashboard-view-using-splunk-java-sdk/m-p/258848#M16283</link>
      <description>&lt;P&gt;I myself found the query. &lt;BR /&gt;
Use below query to create a dashboard.&lt;/P&gt;

&lt;P&gt;Service service = Service.connect(loginArgs);&lt;BR /&gt;
System.out.println("Version "+service.version);&lt;BR /&gt;
JobArgs jobargs = new JobArgs();&lt;BR /&gt;
jobargs.put("name", "TestAutomation1");&lt;BR /&gt;
jobargs.put("eai:data", "the_Automation_new_label");&lt;BR /&gt;
jobargs.put("eai:type", "views");&lt;BR /&gt;
service.post("/servicesNS/admin/search/data/ui/views/newSrini",jobargs);&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 17:46:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/how-to-create-dashboard-view-using-splunk-java-sdk/m-p/258848#M16283</guid>
      <dc:creator>srinivasup</dc:creator>
      <dc:date>2020-09-29T17:46:56Z</dc:date>
    </item>
    <item>
      <title>Re: how to create dashboard/view using splunk java sdk?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/how-to-create-dashboard-view-using-splunk-java-sdk/m-p/258849#M16284</link>
      <description>&lt;P&gt;I had great success with the following:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    Service service = getSplunkService();

    String dashboardName = "rest_dashboard";

    String dashboardXml = "&amp;lt;dashboard&amp;gt;\n" +
        "  &amp;lt;label&amp;gt;temp&amp;lt;/label&amp;gt;\n" +
        "  &amp;lt;row&amp;gt;\n" +
        "    &amp;lt;panel&amp;gt;\n" +
        "      &amp;lt;chart&amp;gt;\n" +
        "        &amp;lt;search&amp;gt;\n" +
        "          &amp;lt;query&amp;gt;index=_internal\n" +
        "                  |  timechart count&amp;lt;/query&amp;gt;\n" +
        "          &amp;lt;earliest&amp;gt;-1h@h&amp;lt;/earliest&amp;gt;\n" +
        "          &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;\n" +
        "          &amp;lt;sampleRatio&amp;gt;1&amp;lt;/sampleRatio&amp;gt;\n" +
        "        &amp;lt;/search&amp;gt;\n" +
        "      &amp;lt;/chart&amp;gt;\n" +
        "    &amp;lt;/panel&amp;gt;\n" +
        "  &amp;lt;/row&amp;gt;\n" +
        "&amp;lt;/dashboard&amp;gt;";

    JobArgs jobargs = new JobArgs();
    jobargs.put("name", dashboardName);
    jobargs.put("eai:type", "views");
    jobargs.put("eai:data", dashboardXml);
    String endpoint = String.format("/servicesNS/rest_user/app_name/data/ui/views/%s", dashboardName);
    service.post(endpoint, jobargs);
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 26 Jul 2019 14:48:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/how-to-create-dashboard-view-using-splunk-java-sdk/m-p/258849#M16284</guid>
      <dc:creator>markbarber21</dc:creator>
      <dc:date>2019-07-26T14:48:05Z</dc:date>
    </item>
  </channel>
</rss>

