I installed node.js ,copied xmljson to splunk app.
Done with everything as per the document.
The client side program is as follows:
<script type="text/javascript" charset="utf-8">
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
service.login(function(err, success) {
// We check for both errors in the connection as well
// as if the login itself failed.
if (err || !success) {
console.log("Error in logging in");
done(err || "Login failed");
return;
}
// 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 < appsList.length; i++) {
myapps += "App " + i + ": " + appsList[i].name + "<br/>"
}
document.getElementById("applist").innerHTML=myapps;
});
}
</script>
Please help. Every time I am getting error message as "There was an error retrieving the list of applications".
I have made another question as there is not enough room in the comment. See
http://splunk-base.splunk.com/answers/84184/javascript-sdk-internal-server-error
@guilhem - What error are you running into? Assuming that you are using node v0.8.x.
Did you solve this problem? I have exactly the same error as you describe and would be interested in a solution.
By the way you need to use node v0.8.x (and not the latest release) as otherwise it will not work. see http://splunk-base.splunk.com/answers/79378/splunk-502-javascript-sdk-server-error-500-examples-brow...
There are a few issues with what you are doing:
node sdkdo examples
from the command line. This is also documented at JavaScript SDK Browser Examples.