Google Crest Script version 12a beta release
Good morning everyone.
I have finally made time to do a little work on GCS. This brings the version up to the 12 series (11 was skipped since it holds bulk data functions I was trying to get to work).
The 12a beta script is up in GitHub. You can always find the latest scripts there: https://github.com/nuadi/googlecrestscript
Changes
- Removed the
getMarketItemListfunction. This function was a mistake. CCP has failed to recognize a need for a list-based endpoint for market orders, so I tried to work around it. However, Google's restrictions on custom functions and UrlFetchApp quotas has made this function more trouble than it's worth. So, I've purged it from this version, and all moving forward. If you insist on keeping it, then you can copy it out of a previous version. However, I will not support it after this version is final. - Migrated
getMarketJsonto use ESI. This is not a public function, but it is the core ofgetOrders,getOrdersAdv,getStationMarketPrice, andgetRegionMarketPrice. As such, this script is only in beta right now. If you would like to test it, you will find aMarketScript_12a_beta.gsfile in the repository right now. Copy that script into a sheet and see how it goes. As always, let me know if you hit any errors. - Removed retries. Previously, when a UrlFetchApp call failed, I would parse the error message to try and determine why. If it was a service error (e.g. 5xx error code), then the script would attempt to retry 3 times. This just leads to more UrlFetchApp calls. In addition, if all retries failed it would result in some functions returning 0 for a price - which is not informative as to the cause of the failure. Therefore, this has all been removed. From now on you will get the full error until I find a more elegant way to handle retries.
Again, this is a beta release. Look for the beta script named MarketScript_12a_beta.gs and copy it into a sheet as usual. I recommend making a copy of any production-class sheets to ensure proper function.
Functionality downgrade
Moving forward into ESI there are going to be functions that lose data or fail to provide information. Right now that is the name of stations for market orders. So, if you use getOrders or getOrdersAdv then you are going to have a rough time of it.
For some silly a really complex and gnarly reason, if a citadel ID is used in a market order then you have to authenticate with ESI in order to get just the name of said citadel. Why this public-private relationship even exists is beyond me the child of some really complex changes and competing ideas, but I brought it up to CCP ages ago and I see it's still lingering. As such, I'll try to find a simple way to auth with ESI in the future, but for now you are going to lose station Citadel names moving forward.
Additionally, the getMarketItems function has no future in ESI for some bewildering reason because they missed it. So, this function will continue to operate until CCP sunsets CREST in May migrates it to ESI. Hopefully they get their act together by then realize I was grumpy and give us a migration path for functions like this soon (tm).
Closing
As always, post issues in GitHub or message me here if you hit bugs. If I don't get any major complaints in the next few weeks then I will roll over the beta to production level and start work on something else if I can find time.
Now back to work.
o7
~nuadi
Edit 1: Changes based on discussion with CCP Bartender. Good talk. Appreciate the time.
Posted Aug 20, 2017, 1:51 PM UTC · edited
You need authentication because the api won't return results if the character used for authentication isn't on the access control list for that particular citadel.
Yep. I completely understand the system. I was the pilot that discovered market orders from citadels were leaking into the CREST output, and convinced CCP to keep them there. However, that was ages ago in CREST where there was a clean public-public relationship. Now, in ESI, it's changed to public-private and it makes app development very weird.
So if I'm understanding you correctly, you're advocating for public citadels (aka, ones with orders that show up in the bulk endpoints) to not require authentication?
Yes. After talking to CCP Bartender, it's not that simple right now but that's what devs like me need. In the meantime I will have to write an auth layer.
https://github.com/googlesamples/apps-script-oauth2
This can be altered to work with SSO/ESI. However the one caveat being can only auth one character at a time without more work.
Example being in how i implemented it in :
https://github.com/Blacksmoke16/GESI