The Steam Web API has a function for getting information on a published Workshop file called GetPublishedFileDetails. It says I can make a request for multiple files, but I cannot figure out how to do this with Javascript. At the moment, I have to make multiple calls to the API, which seems unnecessary.
I've tried sending it an array, strings, everything I can think of.
for (let index = 0; index < arrayOfAddonIds.length; index++) {
$.ajax({
type: 'POST',
url: 'https://api.steampowered.com/ISteamRemoteStorage/GetPublishedFileDetails/v1/',
data: {
'itemcount': 1,
'publishedfileids[0]': parseInt(arrayOfAddonIds[index]),
},
dataType: 'json',
}).done((data) => {
console.log()
populateAddonList(addon_data);
}).fail((err) => {
console.log(err);
}).always((data) => {
var addon = data.response.publishedfiledetails["0"];
if (addon.result == 1) {
for (let i = 0; i < Object.keys(data).length; i++) {
var addonObject = {
"title": addon.title,
"id": addon.publishedfileid
}
addon_data.push(addonObject);
}
}
});
}
Is there a way I could achieve this in one call to the API?
This is also Electron app, maybe that opens up some possibilities.
I guess that you have to do an array like this:
data: {
'itemcount': 3, // Increase itemcount
'publishedfileids[0]': ID0,
'publishedfileids[1]': ID1,
'publishedfileids[2]': ID2, // Add items accordingly
},