SHOW:
|
|
- or go back to the newest paste.
1 | Original script: | |
2 | function GetItemSellValue(itemID) { | |
3 | var myUrl = "http://www.gw2spidy.com/api/v0.9/json/item/" + escape(itemID); | |
4 | var jsonData = UrlFetchApp.fetch(myUrl); | |
5 | var jsonString = jsonData.getContentText(); | |
6 | var jsonObject = JSON.parse(jsonString).result; | |
7 | var adjustedValue = (jsonObject.min_sale_unit_price / 100); | |
8 | return adjustedValue; | |
9 | } | |
10 | ||
11 | ||
12 | ||
13 | Separate connections: | |
14 | function GetItem(itemID) { | |
15 | var myUrl = "http://www.gw2spidy.com/api/v0.9/json/item/" + escape(itemID); | |
16 | var jsonData = UrlFetchApp.fetch(myUrl); | |
17 | var jsonString = jsonData.getContentText(); | |
18 | return jsonObject; | |
19 | } | |
20 | ||
21 | function GetItemExchangeValue(jsonObject) { | |
22 | return(jsonObject.min_sale_unit_price / 100) | |
23 | } | |
24 | ||
25 | ||
26 | ||
27 | GW2 v2 API: | |
28 | function Test(itemID) { | |
29 | var myUrl = "https://api.guildwars2.com/v2/commerce/exchange" + escape(itemID); | |
30 | var jsonData = UrlFetchApp.fetch(myUrl); | |
31 | var jsonString = jsonData.getContentText(); | |
32 | var jsonObject = JSON.parse(jsonString).result; | |
33 | var adjustedValue = (jsonObject.exchange /100); | |
34 | return adjustedValue; | |
35 | } |