Am i doing anything wrong here, first API returns list of SKU's which are queried in the loop to get build list. Sometimes they do get all the builds list correctly but most of the times I get this error
The requested resource is not available. Apache Tomcat/7.0.64
Am I spamming the API calls here ? The API works fine If i query it directly.
getVersionsForPlaytest: function (shiftTitleId, shiftPlatformId, email, callback) {
//console.log('getversions platform ', shiftPlatformId);
client.operation('GetSkusList')
.params({
'Platform ID': shiftPlatformId,
'Title ID': shiftTitleId,
'User': email
})
.headers(getHeaders(email))
.execute(function (err, skus) {
if (err) {
Log.error('Shift', 'Failed to get SKUs for "' + shiftTitleId + '"', {err});
callback(err);
} else {
if (skus.value.length) {
// console.log('getversions sku length - ', skus.value.length);
var promises = [];
var versions = [];
var i = 0;
var len = skus.value.length;
while (i < len) {
(function (sku) {
promises.push(function (callback) {
client.operation('GetBuildsList')
.params({
'SKU ID': sku['SKU ID'],
'Lifecycle Status': 'Available',
'Build Type': 'Playtest',
'User': email
})
.headers(getHeaders(email))
.execute(function (err, data) {
if (err) {
Log.error('Shift', 'Failed to get version for SKU "' + sku['SKU ID'] + '"', {err});
} else if (data.value.length) {
// console.log('getversions getbuildlist length - ', data.value.length);
versions = versions.concat(data.value);
//console.log('getversions getbuildlist - ', data.value);
}
callback();
});
});
})
(skus.value[i]);
i++;
}
async.parallel(promises, function () {
versions = versions.map(function (item) {
item.buildId = item['Build ID'];
return item;
});
callback(err, versions);
});
} else {
callback(err, []);
}
}
})
}
via Bharat Singh
No comments:
Post a Comment