•   over 3 years ago

Reading software install date shows value undefine...

1.) am trying to read install date and identity of install software, i was able to get other variable but install_date and identity parameters says value undefine.

below is the script

var card = new SW.Card();
var inventory = card.services('inventory');

inventory.request('software').then(function(data){

$.each(data.software, function(index, device){

$('body').append('sotware install date:' + device.install_date + 'ident: ' + device.identity);

});
});

2.) Is there any way to get the date software was deleted.

its urgent.

thanks

  • 3 comments

  • Moderator   •   over 3 years ago

    1.) Each item in data.software represents a software application. Each software application has a list of devices that it is installed on, 'data.software[0].computers'. Each device then has an install date, so to get the first device install date on the first software application it would be: 'data.software[0].computers[0].install_date'. The identity is similarly, 'data.software[0].computers[0].identity'. However, the identity may not always be defined.

    2.) Unfortunately, there's no way to get this via the API right now. We do store this information in the database via our Activity Timeline, but right now we don't have API access to that data.

    Let me know if you have any other questions.

  • Moderator   •   over 3 years ago

    Try something like this:

    var card = new SW.Card();
    var inventory = card.services('inventory');

    inventory.request('software').then(function(data){
    $.each(data.software, function(index, title){
    $.each(title.computers, function(index, device){
    console.log('software title: ' + title.vendor + ' ' + title.name + ' installed on device: ' + device.name + ' on date: ' + device.install_date);
    });
    });
    });

  • Moderator   •   over 3 years ago

    Sorry for the formatting, DevPost doesn't seem to have a good way to format code.

Comments are closed.