Advertisement
DennisChrDk

GW2 Spidy API

Aug 22nd, 2014
278
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function GetItemSellValue(itemID) {
  2.   var myUrl = "http://www.gw2spidy.com/api/v0.9/json/item/" + escape(itemID);
  3.   var jsonData = UrlFetchApp.fetch(myUrl);
  4.   var jsonString = jsonData.getContentText();
  5.   var jsonObject = JSON.parse(jsonString).result;
  6.   var adjustedValue = (jsonObject.min_sale_unit_price / 100);
  7.   Utilities.sleep(1000);
  8.   return adjustedValue;  
  9. }
  10.  
  11. function SalePriceChangedLastHour(itemID) {
  12.   var myUrl = "http://www.gw2spidy.com/api/v0.9/json/item/" + escape(itemID);
  13.   var jsonData = UrlFetchApp.fetch(myUrl);
  14.   var jsonString = jsonData.getContentText();
  15.   var jsonObject = JSON.parse(jsonString).result;
  16.   var adjustedValue = (jsonObject.sale_price_change_last_hour / 100);
  17.   Utilities.sleep(1000);
  18.   return adjustedValue;  
  19. }
  20.  
  21.   function GetItemBuyValue(itemID) {
  22.   var myUrl = "http://www.gw2spidy.com/api/v0.9/json/item/" + escape(itemID);
  23.   var jsonData = UrlFetchApp.fetch(myUrl);
  24.   var jsonString = jsonData.getContentText();
  25.   var jsonObject = JSON.parse(jsonString).result;
  26.   var adjustedValue = (jsonObject.max_offer_unit_price / 100);
  27.   Utilities.sleep(1000);
  28.   return adjustedValue;
  29. }
  30.  
  31.   function OfferPriceChangedLastHour(itemID) {
  32.   var myUrl = "http://www.gw2spidy.com/api/v0.9/json/item/" + escape(itemID);
  33.   var jsonData = UrlFetchApp.fetch(myUrl);
  34.   var jsonString = jsonData.getContentText();
  35.   var jsonObject = JSON.parse(jsonString).result;
  36.   var adjustedValue = (jsonObject.offer_price_change_last_hour / 100);
  37.   Utilities.sleep(1000);
  38.   return adjustedValue;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement