<?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: Not able to connect to splunk using javascript sdk in Splunk Dev</title>
    <link>https://community.splunk.com/t5/Splunk-Dev/Not-able-to-connect-to-splunk-using-javascript-sdk/m-p/67605#M933</link>
    <description>&lt;P&gt;@guilhem - What error are you running into? Assuming that you are using node v0.8.x.&lt;/P&gt;</description>
    <pubDate>Wed, 17 Apr 2013 14:04:50 GMT</pubDate>
    <dc:creator>Neeraj_Luthra</dc:creator>
    <dc:date>2013-04-17T14:04:50Z</dc:date>
    <item>
      <title>Not able to connect to splunk using javascript sdk</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Not-able-to-connect-to-splunk-using-javascript-sdk/m-p/67602#M930</link>
      <description>&lt;P&gt;I installed node.js ,copied xmljson to splunk app.&lt;BR /&gt;
Done with everything as per the document.&lt;BR /&gt;
The client side program is as follows:&lt;/P&gt;

&lt;P&gt;&lt;BR /&gt;
  &lt;BR /&gt;
    &lt;META charset="utf-8" /&gt;&lt;BR /&gt;
    &lt;TITLE&gt;How to start a Splunk session&lt;/TITLE&gt;&lt;BR /&gt;
    &lt;SCRIPT type="text/javascript" src="C:/Program Files/splunk-sdk/examples/browser/resources/jquery.min.js"&gt;&lt;/SCRIPT&gt;&lt;BR /&gt;
    &lt;SCRIPT type="text/javascript" src="&amp;lt;br&amp;gt;
C:/Program Files/splunk-sdk/client/splunk.js"&gt;&lt;/SCRIPT&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;script type="text/javascript" charset="utf-8"&amp;gt;
function displayApps() {
    var http = new splunkjs.ProxyHttp("/proxy");

    // Create a Service instance and log in 
    var service = new splunkjs.Service(http, {
        username:"admin",
        password:"kav$tim1",
        scheme:"http",
        host:"localhost",
        port:"8089",
        version:"5.0"
    });

   // Verify we logged in


 // First, we log in
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;service.login(function(err, success) {&lt;BR /&gt;
    // We check for both errors in the connection as well&lt;BR /&gt;
    // as if the login itself failed.&lt;BR /&gt;
    if (err || !success) {&lt;BR /&gt;
        console.log("Error in logging in");&lt;BR /&gt;
        done(err || "Login failed");&lt;BR /&gt;
  return;&lt;BR /&gt;
   } &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    // Print installed apps to the console to verify login
    service.apps().fetch(function(err, apps) {
        if (err) {
       console.log("There was an error retrieving the list of applications:", err);
        done(err);
        return;
        }

        var myapps = "";
        var appsList = apps.list();
        console.log("Applications:");
        for(var i = 0; i &amp;lt; appsList.length; i++) {
            myapps += "App " + i + ": " + appsList[i].name + "&amp;lt;br/&amp;gt;"
        } 

        document.getElementById("applist").innerHTML=myapps;
    });

}
&amp;lt;/script&amp;gt; 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;BR /&gt;
&lt;BR /&gt;
    &lt;BUTTON type="button" onclick="displayApps()"&gt;Log in and list apps&lt;/BUTTON&gt;&lt;BR /&gt;
    &lt;/P&gt;&lt;P id="applist"&gt;&lt;/P&gt;&lt;BR /&gt;
&lt;BR /&gt;
&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Mar 2013 11:51:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Not-able-to-connect-to-splunk-using-javascript-sdk/m-p/67602#M930</guid>
      <dc:creator>kavyatim</dc:creator>
      <dc:date>2013-03-20T11:51:11Z</dc:date>
    </item>
    <item>
      <title>Re: Not able to connect to splunk using javascript sdk</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Not-able-to-connect-to-splunk-using-javascript-sdk/m-p/67603#M931</link>
      <description>&lt;P&gt;There are a few issues with what you are doing:&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;If you are on Splunk 5, you do not need xml2json, unless of course you are trying to run the unit tests.&lt;/LI&gt;
&lt;LI&gt;service.login function call is missing a couple of closing parenthesis.&lt;/LI&gt;
&lt;LI&gt;scheme should be https, unless you have changed the default Splunk installation.&lt;/LI&gt;
&lt;LI&gt;You need to serve this page from a web server and in that web server you will need to set up the proxy. This last steps is taken care of if you run the examples through node, i.e. &lt;CODE&gt;node sdkdo examples&lt;/CODE&gt; from the command line. This is also documented at &lt;A href="http://dev.splunk.com/view/SP-CAAAEDC"&gt;JavaScript SDK Browser Examples&lt;/A&gt;.&lt;/LI&gt;
&lt;/OL&gt;</description>
      <pubDate>Thu, 21 Mar 2013 05:44:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Not-able-to-connect-to-splunk-using-javascript-sdk/m-p/67603#M931</guid>
      <dc:creator>Neeraj_Luthra</dc:creator>
      <dc:date>2013-03-21T05:44:12Z</dc:date>
    </item>
    <item>
      <title>Re: Not able to connect to splunk using javascript sdk</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Not-able-to-connect-to-splunk-using-javascript-sdk/m-p/67604#M932</link>
      <description>&lt;P&gt;Did you solve this problem? I have exactly the same error as you describe and would be interested in a solution.&lt;/P&gt;

&lt;P&gt;By the way you need to use node v0.8.x (and not the latest release) as otherwise it will not work. see &lt;A href="http://splunk-base.splunk.com/answers/79378/splunk-502-javascript-sdk-server-error-500-examples-browsertests"&gt;http://splunk-base.splunk.com/answers/79378/splunk-502-javascript-sdk-server-error-500-examples-browsertests&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Apr 2013 08:42:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Not-able-to-connect-to-splunk-using-javascript-sdk/m-p/67604#M932</guid>
      <dc:creator>guilhem</dc:creator>
      <dc:date>2013-04-17T08:42:29Z</dc:date>
    </item>
    <item>
      <title>Re: Not able to connect to splunk using javascript sdk</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Not-able-to-connect-to-splunk-using-javascript-sdk/m-p/67605#M933</link>
      <description>&lt;P&gt;@guilhem - What error are you running into? Assuming that you are using node v0.8.x.&lt;/P&gt;</description>
      <pubDate>Wed, 17 Apr 2013 14:04:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Not-able-to-connect-to-splunk-using-javascript-sdk/m-p/67605#M933</guid>
      <dc:creator>Neeraj_Luthra</dc:creator>
      <dc:date>2013-04-17T14:04:50Z</dc:date>
    </item>
    <item>
      <title>Re: Not able to connect to splunk using javascript sdk</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Not-able-to-connect-to-splunk-using-javascript-sdk/m-p/67606#M934</link>
      <description>&lt;P&gt;I have made another question as there is not enough room in the comment. See &lt;BR /&gt;
 &lt;A href="http://splunk-base.splunk.com/answers/84184/javascript-sdk-internal-server-error"&gt;http://splunk-base.splunk.com/answers/84184/javascript-sdk-internal-server-error&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Apr 2013 14:22:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Not-able-to-connect-to-splunk-using-javascript-sdk/m-p/67606#M934</guid>
      <dc:creator>guilhem</dc:creator>
      <dc:date>2013-04-17T14:22:56Z</dc:date>
    </item>
    <item>
      <title>Re: Not able to connect to splunk using javascript sdk</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Not-able-to-connect-to-splunk-using-javascript-sdk/m-p/67607#M935</link>
      <description>&lt;P&gt;Please help. Every time I am getting error message as "There was an error retrieving the list of applications".&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jul 2017 14:17:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Not-able-to-connect-to-splunk-using-javascript-sdk/m-p/67607#M935</guid>
      <dc:creator>jitendra0101</dc:creator>
      <dc:date>2017-07-18T14:17:33Z</dc:date>
    </item>
  </channel>
</rss>

