LeonBel
Leon Enterprise Solutions Wormlife
0
|
Posted - 2016.12.23 23:26:50 -
[1] - Quote
Hi Guys,
I'm not an expert in building XML API calls from my excel sheet so apologise in advance if its basic question but i wasn't able to find answer using search here or reddit.
I have several characters doing industry and wanted to pul alll outstanding jobs a single array into excel using XML api for all characters, instead of using separate sheet for each character that i have right now to sum up everything. Is there more efficient way to structure the call in such a way for it to pull several charater jobs (supplying KeyID,vcode,char id within code itself is perfectly fine)
[code
function loadJobs(type, keyID, vCode, characterID,history){ if (typeof history == 'undefined'){ historyurl=''; } else { historyurl='History'; } var jobs= new Array(); jobs.push(["jobID","installerID","installerName","facilityID","solarSystemID","solarSystemName","stationID","activityID","blueprintID","blueprintTypeID","blueprintTypeName" ,"blueprintLocationID","outputLocationID","runs","successfulRuns","cost","teamID","licensedRuns","probability","productTypeID","productTypeName","status","timeInSeconds", "startDate","endDate","pauseDate","completedDate","completedCharacterID"]); status={1:"Active",2:"Paused",3:"Ready",101:"Delivered",102:"Cancelled",103:"Reverted"}; var url = "https://api.eveonline.com/"+type+"/IndustryJobs"+historyurl+".xml.aspx?keyID="+keyID+"&vCode="+vCode+"&characterID="+characterID; var parameters = {method : "get", payload : ""}; var xmlFeed = UrlFetchApp.fetch(url, parameters).getContentText(); var xml = XmlService.parse(xmlFeed);
if(xml) { var rows=xml.getRootElement().getChild("result").getChild("rowset").getChildren("row"); for(var i = 0; i < rows.length; i++) { job=[parseInt(rows[i].getAttribute('jobID').getValue()), parseInt(rows[i].getAttribute('installerID').getValue()), rows[i].getAttribute('installerName').getValue(), parseInt(rows[i].getAttribute('facilityID').getValue()), parseInt(rows[i].getAttribute('solarSystemID').getValue()), rows[i].getAttribute('solarSystemName').getValue(), parseInt(rows[i].getAttribute('stationID').getValue()), parseInt(rows[i].getAttribute('activityID').getValue()), parseInt(rows[i].getAttribute('blueprintID').getValue()), parseInt(rows[i].getAttribute('blueprintTypeID').getValue()), rows[i].getAttribute('blueprintTypeName').getValue(), parseInt(rows[i].getAttribute('blueprintLocationID').getValue()), parseInt(rows[i].getAttribute('outputLocationID').getValue()), parseInt(rows[i].getAttribute('runs').getValue()), parseInt(rows[i].getAttribute('successfulRuns').getValue()), parseFloat(rows[i].getAttribute('cost').getValue()), parseInt(rows[i].getAttribute('teamID').getValue()), parseInt(rows[i].getAttribute('licensedRuns').getValue()), rows[i].getAttribute('probability').getValue(), parseInt(rows[i].getAttribute('productTypeID').getValue()), rows[i].getAttribute('productTypeName').getValue(), status[parseInt(rows[i].getAttribute('status').getValue())], parseInt(rows[i].getAttribute('timeInSeconds').getValue()), rows[i].getAttribute('startDate').getValue(), rows[i].getAttribute('endDate').getValue(), rows[i].getAttribute('pauseDate').getValue(), rows[i].getAttribute('completedDate').getValue(), parseInt(rows[i].getAttribute('completedCharacterID').getValue()) ]; jobs.push(job); } } return jobs; }
[/code]
I hope someone can help and please let me know if i wasnt clear on what i'm trying to do.
thanks a lot guys! |