Blacksmoke16 / GESI

Google Sheets™ ESI Add-on
https://blacksmoke16.github.io/GESI
MIT License
196 stars 37 forks source link

universe_structures_structure request error #86

Closed multru closed 3 years ago

multru commented 3 years ago

I receive this kind of error when trying to take structure data automatically with google script code Error: {"error":"Forbidden"} doRequest execute invoke universe_structures_structure

What does it mean and can I skip this kind of errors?

Blacksmoke16 commented 3 years ago

@multru This means you do not have access that that structure. I.e. are not on the ACL for it. Where does this ID come from/what are you wanting to do?

multru commented 3 years ago

I'm parsing corporate memberTracking data. Forst step I receiving data for all location_id data. I was split this ID's into systems, stations (NPC) and structures. And in this script, I receive this error. And I can't figure out how to skip this, maybe it's better to get this 'forbidden' as data than as an error?

Blacksmoke16 commented 3 years ago

Oops, sorry for the delay @multru!

For your use case I would suggest to keep a static list and just vlookup the names of each location. This way you avoid making extra requests which will make things more performant. It also allows you to give custom names to each structure if you actually know the name but it's unresolveable via ESI.

Another option would be to move your logic into a custom function which would allow using JS exception handling features.

Feel free to stop by the Discord server if you want to chat about it more.

multru commented 3 years ago

thx for your reply @Blacksmoke16 the exception is a great idea! I just forgot about this ) About performance, this script is built my static table. Because in a first way I'm checking if these names (stations, characters, ships) are already present in my table, and if no I request this data by GESI. Issue is closed.