Jump to content
  • Sign Up

Help with a couple simple script updates


Kruhljak.2705

Recommended Posts

Could someone with knowledge please do me a favor and adapt these two script bits to use the GW2 API rather than retrieving the data from Spidy?  They're being used in a google docs spreadsheet and despite being several years old, still work.   The issue is that Spidy data is often stale, and I understand the GW2 API only caches for 10m or so?  Not sure.  I just figure getting the data directly from the source is going to be more fresh.

 

TIA!


function getItemHighOffer(itemID) {
  var myUrl = "http://www.gw2spidy.com/api/v0.9/json/item/" + escape(itemID);
  var jsonData = UrlFetchApp.fetch(myUrl);
  var jsonString = jsonData.getContentText();
  var jsonObject = JSON.parse(jsonString).result;
  var maxofferValue = (jsonObject.max_offer_unit_price);
  return maxofferValue;
}


function getItemLowSell(itemID) {
  var myUrl = "http://www.gw2spidy.com/api/v0.9/json/item/" + escape(itemID);
  var jsonData = UrlFetchApp.fetch(myUrl);
  var jsonString = jsonData.getContentText();
  var jsonObject = JSON.parse(jsonString).result;
  var lowsellValue = (jsonObject.min_sale_unit_price);
  return lowsellValue;
}

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...