These forums have been archived and are now read-only.

The new forums are live and can be found at https://forums.eveonline.com/

EVE Technology Lab

 
  • Topic is locked indefinitely.
 

API import google docs

First post
Author
Dean Hekki
Nerapa Krabbing Industries
#1 - 2015-04-19 22:35:02 UTC
Ok, this is annoying, can anyone see what is wrong with this?

=IMPORTXML("https://api.eveonline.com/Account/Characters.xml.aspx?keyID=XXXX&vCode=YYYY", "//name")


The link works but it will only spit out a N/A


a browser shows its the right URL anyway
Kali Izia
GoomWaffe
#2 - 2015-04-19 23:22:51 UTC
Your "//name" xpath means you're looking for a tag called name which doesn't exist.
To get an attribute called name you want to do something like ʺ//row/@nameʺ.
Dean Hekki
Nerapa Krabbing Industries
#3 - 2015-04-19 23:26:13 UTC
Works like a charm Thank you! :)

Dean Hekki
Nerapa Krabbing Industries
#4 - 2015-04-19 23:44:27 UTC
So followup question so I can understand better

why wont changing that to name to characterID or corporationName work?

Sorry for being dumb with this but I'm still learning, Im a fast learner once I grasp the concept but I gotta grasp it first :)

I was looking at: http://www.w3schools.com/xpath/xpath_syntax.asp but so far all Ive been able to get is name, and a wildcard of everything there is lol
Steve Ronuken
Fuzzwork Enterprises
Vote Steve Ronuken for CSM
#5 - 2015-04-19 23:55:08 UTC
Google screws with the xml, lower casing all attribute names and node names.

if you look for characterid, you should find it.


https://github.com/fuzzysteve/eve-googledocs-script may be of interest, for an alternate way to work with xml, which is substantially more flexible than importxml

Woo! CSM XI!

Fuzzwork Enterprises

Twitter: @fuzzysteve on Twitter

Dean Hekki
Nerapa Krabbing Industries
#6 - 2015-04-20 00:13:24 UTC
Thanks, I'll start working on learning that since what I want to do is much more complicated than a simple character ID

I can feel the migraines coming on already. :)
Dean Hekki
Nerapa Krabbing Industries
#7 - 2015-04-20 00:51:08 UTC  |  Edited by: Dean Hekki
ok so Ive got this so far


function charID(character,keyID,Vcode){
if (typeof character == 'undefined'){
throw 'Need Character';
}

if (typeof keyID == 'undefined'){
keyID=XXXX;
}

if (typeof Vcode == 'undefined'){
Vcode=XXXXX;
}

var url = "https://api.eveonline.com/Account/Characters.xml.aspx?keyID="+keyID+"&vCode"+Vcode;
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").getChildren("rowset");
}

}



Currently I have my ID and Vcode as default so I can figure out the rest I want it set up so I enter the character for instance charID(Dean Hekki)

This is very basic but its a learning point for me, I try to start out with a single thing then expand from there so I can learn what is going on... Could you tell me if Im at least on the right track, I get confused from here on so trying to figure it out.
Dean Hekki
Nerapa Krabbing Industries
#8 - 2015-04-20 01:59:44 UTC
moral of the story for me today is I hate javascript

Give me php anyday
Dean Hekki
Nerapa Krabbing Industries
#9 - 2015-04-20 02:41:09 UTC
holy crap I got it

function loadSheet(keyID, vCode){
var sheets= new Array();
var url = "https://api.eveonline.com/Account/Characters.xml.aspx?keyID="+keyID+"&vCode="+vCode;
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++) {
sheet=[rows[i].getAttribute("name").getValue(),
rows[i].getAttribute("characterID").getValue(),
rows[i].getAttribute("corporationName").getValue(),
rows[i].getAttribute("corporationID").getValue(),
rows[i].getAttribute("allianceID").getValue(),
rows[i].getAttribute("allianceName").getValue(),
rows[i].getAttribute("factionID").getValue(),
rows[i].getAttribute("factionName").getValue()]
sheets.push(sheet);
}
}
return sheets;
}



its a start lol
Lemkor Gengod
Stacmon Production and Trade Institue
#10 - 2015-04-22 21:26:30 UTC
Steve Ronuken wrote:
Google screws with the xml, lower casing all attribute names and node names.

if you look for characterid, you should find it.


https://github.com/fuzzysteve/eve-googledocs-script may be of interest, for an alternate way to work with xml, which is substantially more flexible than importxml



And it appears within hours of you writing that, Google has fixed the issue that has been around for years

https://forums.eveonline.com/default.aspx?g=posts&t=420225&find=unread


Steve, do you get the feeling that somebody at Google is stalking your internet presence?Lol
salacious necrosis
Garoun Investment Bank
Gallente Federation
#11 - 2015-04-23 02:53:44 UTC
Dean Hekki wrote:
holy crap I got it

function loadSheet(keyID, vCode){
var sheets= new Array();
var url = "https://api.eveonline.com/Account/Characters.xml.aspx?keyID="+keyID+"&vCode="+vCode;
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++) {
sheet=[rows[i].getAttribute("name").getValue(),
rows[i].getAttribute("characterID").getValue(),
rows[i].getAttribute("corporationName").getValue(),
rows[i].getAttribute("corporationID").getValue(),
rows[i].getAttribute("allianceID").getValue(),
rows[i].getAttribute("allianceName").getValue(),
rows[i].getAttribute("factionID").getValue(),
rows[i].getAttribute("factionName").getValue()]
sheets.push(sheet);
}
}
return sheets;
}



its a start lol


You may want to try this if you need more than just the character sheet:

https://www.eve-kit.org/#/main/doc/1416194988795

and the accompanying video:

https://www.youtube.com/watch?v=qVsOldt6RQ4&feature=youtu.be

Use EveKit ! - Tools for EVE Online 3rd party development