These forums have been archived and are now read-only.

The new forums are live and can be found at https://forums.eveonline.com/

EVE Technology Lab

 
  • Topic is locked indefinitely.
 

ESI ship_type_name from ship_type_id

Author
Oublier Heliock
Syndicate of Ale
#1 - 2017-03-21 16:44:12 UTC
Gosh, for the life of me I can't find the end point in ESI https://esi.tech.ccp.is/latest/#/ where you get the ship_type_name from ship_type_id?

Looking at a killmail example:


"victim" => {
              "damage_taken" => 1556,
              "ship_type_id" => 603,
              "character_id" => 96003963,
              "corporation_id" => 98436366,
            ...}


Should be a Merlin. (603)


Thanks in advance for pointing me in the right direction.
Slivo
Beehive Surveillance
X877.
#2 - 2017-03-21 16:56:13 UTC
Try https://esi.tech.ccp.is/latest/#!/Universe/get_universe_types_type_id
Oublier Heliock
Syndicate of Ale
#3 - 2017-03-21 17:02:16 UTC
Slivo wrote:
Try https://esi.tech.ccp.is/latest/#!/Universe/get_universe_types_type_id


Yup yup. Thanks a bunch!
Blacksmoke16
Resilience.
#4 - 2017-03-21 18:38:36 UTC
Easier way would be to just lookup the ship_type_id in the SDE vs doing a separate call to just get the name, assuming you have access to a database with the SDE.
Oublier Heliock
Syndicate of Ale
#5 - 2017-03-21 20:42:42 UTC
Blacksmoke16 wrote:
Easier way would be to just lookup the ship_type_id in the SDE vs doing a separate call to just get the name, assuming you have access to a database with the SDE.



Yes - thanks for that! I didn't realize that you can download the SDE and everything in it is in "yaml" format! I'll just use the needed yaml files for static lookups like this. This one specifically: fsd/typeIDs.yaml

I had created a universe class and a "get_type" method for this; and then plucked the name out of there. Which is like hammering a nail with and elephant tusk. Just to pull 15 killmails with readable data was taking near 10 seconds...

Also, I think I just wanted an excuse to create a "class Universe" in Ruby. :) I guess I can still use it to pull from the yaml file.


Thanks!
Blacksmoke16
Resilience.
#6 - 2017-03-21 20:50:59 UTC  |  Edited by: Blacksmoke16
https://www.fuzzwork.co.uk/dump/

Steve provides the conversions if you want to use PostGres or MySQL etc

Also +1 for the Ruby ;)

I assume you are using activerecord?

If so you would just import the tables you need, setup the relations if any, then could do like:
Item.find(type_id).typeName
Oublier Heliock
Syndicate of Ale
#7 - 2017-03-21 21:56:53 UTC  |  Edited by: Oublier Heliock
Mongoid.
Oublier Heliock
Syndicate of Ale
#8 - 2017-03-23 06:08:57 UTC  |  Edited by: Oublier Heliock
I ended up creating a Ship mongoid model with name and ID . So basically I still call ESI to get the ship name, but first I look at my Ship model and if the id, name doesn't exist then add it. A sort of self building ship_id to ship_name lookup mongo collection with a RESTFUL interface to boot. So when I want to stop being lazy I can use the REST interface later to populate all ship id's and names; however if I'm lazy enough I'll eventually have them all anyway. Pirate

Ship.find_by(ship_type_id: ship_type_id).ship_type_name