Pages: [1] :: one page |
|
Author |
Thread Statistics | Show CCP posts - 0 post(s) |
Jekira Nu
Tribal Liberation Force Minmatar Republic
0
|
Posted - 2014.07.24 22:32:00 -
[1] - Quote
I'm trying to write a script to acquire JSON data from EVE-MarketData and have it on my Google Sheet.
My point that I'm trying to access is : [url]http://api.eve-marketdata.com/api/item_prices2.json?char_name=demo&type_ids=34&station_ids=60003760&buysell=s[/url]
And I've been trying this :
Quote: function simplejita(item) { var jsondata = UrlFetchApp.fetch("http://api.eve-marketdata.com/api/item_prices2.json?char_name=demo&buysell=s&station_ids=60003760&type_ids="+item);
var object = Utilities.jsonParse(jsondata.getContentText());
return object.emd.result.row.price; }
All I want to do is pass in the item_id and get out the price. I can't seem to get anything out of it, either it is an error or a blank cell.
|
salacious necrosis
Federal Defense Union Gallente Federation
0
|
Posted - 2014.07.25 06:13:00 -
[2] - Quote
object.emd.result is an array which you need to index. Example:
http://api.eve-marketdata.com/api/item_prices2.json?char_name=demo&buysell=s&station_ids=60003760&type_ids=5
gives the JSON response:
{ "emd": { "version": 2, "currentTime": "2014-07-25T5:22:21Z", "name": "item_prices", "key": "buysell,typeID,stationID", "columns": "buysell,typeID,stationID,price,updated", "result": [{ "row": { "buysell": "s", "stationID": "60003760", "typeID": "5", "price": "0", "updated": "2014-07-25 5:22:21" } }] } }
so you want object.emd.result[0].row.price
Also, note that Utilities.jsonParse was deprecated. You'll want to use JSON.parse instead.
|
Jekira Nu
Tribal Liberation Force Minmatar Republic
0
|
Posted - 2014.07.25 11:08:00 -
[3] - Quote
Excellent!
Thanks salacious. |
Wafflehead
Hurricane Research
101
|
Posted - 2014.07.25 11:58:00 -
[4] - Quote
Move away from spreadsheets or use PHP or create a proper application (.Net, C#, VB.Net) etc. |
Jekira Nu
Tribal Liberation Force Minmatar Republic
0
|
Posted - 2014.07.25 12:05:00 -
[5] - Quote
I think that's the direction I'll have to move. I've definitely pushed what Google Sheets is capable of. The crunch times are getting too long.
|
|
|
|
Pages: [1] :: one page |
First page | Previous page | Next page | Last page |