Ad
Can't Figure Out How To Pass Steam Web API A Int64
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.
Ad
Answer
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
},
Ad
source: stackoverflow.com
Related Questions
- → How to update data attribute on Ajax complete
- → October CMS - Radio Button Ajax Click Twice in a Row Causes Content to disappear
- → Octobercms Component Unique id (Twig & Javascript)
- → Passing a JS var from AJAX response to Twig
- → Laravel {!! Form::open() !!} doesn't work within AngularJS
- → DropzoneJS & Laravel - Output form validation errors
- → Import statement and Babel
- → Uncaught TypeError: Cannot read property '__SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED' of undefined
- → React-router: Passing props to children
- → ListView.DataSource looping data for React Native
- → Can't test submit handler in React component
- → React + Flux - How to avoid global variable
- → Webpack, React & Babel, not rendering DOM
Ad