Yoone.9461:

Hello Cliff,

Would it be possible for you to release an icon package for all the items the API refers to? It would really help for the creation of an item database.
I know this is complicated, because you would have to release all icons from the game, or release a new package for every update. But if there is a way, please do it!

And I don’t think you would do that, but maybe if you could also add the code to link items in-game, it would be more than much appreciated.

Thanks a lot for the API, I have been waiting a long time for it since I heard about it. And good luck improving and updating it!

Healix.5819:

I doubt they have all the icons in a way they can just add it to the API. The TP however has all the icons since that’s how it works.

The fastest way to grab all those icons is by getting the list of all items through gw2spidy: http://www.gw2spidy.com/api/v0.9/json/all-items/all

The chat link code is basically already given, just not in the right form. You can create the code yourself using the item’s id. http://wiki.guildwars2.com/wiki/Chat_link_format

Yoone.9461:

I was thinking about crawling an already existent database, but I haven’t thought about the gw2spidy API, thank you for your help!

DarkSpirit.7046:

Or you can use their trading post api which has not been officially released yet.

You need to login with your GW2 credentials first. To login:

https://account.guildwars2.com/login?redirect_uri=http%3A%2F%2Ftradingpost-live.ncplatform.net%2Fauthenticate%3Fsource%3D%252F&game_code=gw2

Then:
https://tradingpost-live.ncplatform.net/ws/search.json?ids=<item id>

For example for Black Peppercorn:

https://tradingpost-live.ncplatform.net/ws/search.json?ids=12236

The icon url would be:

https://dfach8bufmqqv.cloudfront.net/gw2/img/content/7736de3a.png

Yoone.9461:

Thank you! This is just even better

Yoone.9461:

Sorry for the double post, I just had a question about how to get every item icon in the game.

I made a script that asks for a GW2 account when it starts, and then uses it to log in the Trading Post and retrieve the icons (using item IDs from the API).

The problem is that when an item is not sold by anyone, the icon URL isn’t given in the parameters… But I noticed the URLs are respecting a pattern:

The only parameter that changes in the URL is 4f7e4ac9. The rest is the same for every item icon.

So my question is: is this related to the ID? This item ID is 100, but I don’t know if there is an algorithm that converts 100 into 4f7e4ac9.

Here are a few more examples:

  • 27321 => d3bca40c
  • 30689 => 6e8fedc6
  • 9288 => ab2fbe7e

Thank you in advance for your answers/hints!

The Talcmaster.7391:

Keep in mind that the TP icons are only the ones that are on the TP currently. I haven’t played with cloudfront myself, but I wouldn’t be surprised if it is just generating the image names randomly (considering they are just hex values). So I would be surprised if there was any way to convert them. Best bet would be to develop a lookup table of the image names.

Healix.5819:

The numbers are probably generated by the cache, which would also mean they should change if the either the cache is emptied for whatever reason or the item is modified. The number could also be a randomly generated unique identifier, similar to the item’s ID, but at a wider ranger (for all images), meaning it would never change, since it would have been assigned when the item was originally created, rather than every time it’s cached.

You should create a cache yourself, mapping ids to images. You can use the items API to get a list of all items, then requests the TP for those item ids to get just the ones you need, or just request the TP for everything.

https://tradingpost-live.ncplatform.net/ws/search.json?ids=1,2,3
or
https://tradingpost-live.ncplatform.net/ws/search.json?text=&levelmin=0&levelmax=80&count=0

Yoone.9461:

I did that, but the icons only appear in the JSON is the item is currently sold by someone.

For example, this item isn’t sold by anyone, and I can’t get the icon: https://tradingpost-live.ncplatform.net/ws/search.json?ids=8587

And the item exists. It comes from the official API, and I also found it on GW2Spidy.

The Talcmaster.7391:

That is correct. If it never has been sold on the TP, there is no image on there yet. As of yet there is no way to get icons for items not on the TP. I would put good money on it coming fairly soon though.

Yoone.9461:

Maybe the icon is removed from the TP cache when there is no more item to sell?

So there is just no solution to get icons of soulbound or accountbound items.

Thanks for your answers!

Healix.5819:

The icon was removed (the old link to it doesn’t exist) because the item was removed from the TP, which is why you can’t search for it. The TP only has the data available for items that can be traded.

An alternative easy way to get the images is to simply use another resource. Use gw2spidy to get the gw2db id and then use their image (http://www.gw2db.com/items/971/tooltip) or use the file id (63081) and extract that file from gw2.dat.