Item-ID by name?

Item-ID by name?

in API Development

Posted by: Scree.1453

Scree.1453

Hi,
is it possible to get the ID of an item by its name? Like:
https://api.guildwars2.com/v2/items/search?name=berserk
-> returns a list of all item-IDs with “berserk” in its name.

I’m currently try to write an overwolf app, so far i tried:
1. gw2spidy-API: works, but only for english names
2. http://gw2wbot.darthmaim.de/smiley/gw2itemsearch.html: doesn’t provied an API afaik
3. search the api via /items -> get a list of all IDs
foreach id -> /items/id -> if name contains “berserk” -> add to list
that takes forever for obvious reasons

Scree

Item-ID by name?

in API Development

Posted by: Lawton Campbell

Lawton Campbell

Web Programmer

Not currently, no. Though it’s something that’s being worked on, it’ll be a month or two until it’s ready to use. There might be third-party sites that provide such an API, but I don’t know of any

Item-ID by name?

in API Development

Posted by: TimeBomb.3427

TimeBomb.3427

You can implement this yourself, if you want to get into something a bit nitty and gritty.

You need a few things:
- A database of item names
- A way to convert an item name to an item code
- A way to convert an item code to an item ID

If I were to go about this, I would likely use the official GW2 wiki as a source of item names. It also pairs most items with their item code, so that works out.

First, you need to be able to crawl a wiki page for its item code (the chat code, e.g. ). You can do this by traversing the DOM. There are many DOM traversal libraries, and potentially even some wiki traversing libraries. Take advantage of them.

Second, please remember to cache. Indefinitely. You only need to find the item code once, because we can use that to get to the item ID. Then you’ll have a permanent local link from item name to item ID.

I’d suggest using your local API to lookup the item ID from the item name. If it doesn’t exist, query the specific item code from the GW2 wiki and convert that to the ID. (And cache it so it’ll exist in the future.)

Now, how do we get the item ID from the item code? Luckily, this is pretty well documented in the Chat link format wiki page

I’ll brief over the basics. Take a look at this chat code for Zojja’s Claymore:
[&AgGqtgAA]

Strip the square brackets and the ampersand, and we have…
AgGqtgAA

Look familiar? That’s base64, a common type of encryption. By converting this base64 to hex, we get the following:
0201AAB60000

Let’s make this easier to read.
02 01 AA B6 00 00

Now, each of these areas means something specific. That’s all detailed in the aforementioned Chat link format wiki page. But let’s not get into all those details.

This format changes depending on the item type and what the chat code is for (i.e. something other than an item), but for most items, it appears that the format here is quite consistent.

Let’s get the item ID. First, we need to do is strip the first couple bytes.
AA B6 00 00

Now, reverse it.
00 00 B6 AA

Remove the spaces…
0000B6AA

Alright, now we have little endian hex. If we convert that to a decimal, we get…
46762

Ta-da. The item ID! Don’t believe me? “See for yourself.”:
https://api.guildwars2.com/v2/items/46762

Happy developing!

Item-ID by name?

in API Development

Posted by: TimeBomb.3427

TimeBomb.3427

Darn, can’t edit my post to fix the couple typos hah.

Anyhow, smiley.1438 mentioned in another thread that MediaWiki, the wiki powering the GW2 wiki, has its own query ability, so you shouldn’t have to traverse the wiki in any fancy way. You can get back more useful, raw data with it. https://www.mediawiki.org/wiki/API:Query

Item-ID by name?

in API Development

Posted by: AfterXII.2761

AfterXII.2761

Hey Scree, I wrote this a while ago for guild backend stuff, I hope it finds you well.

http://www.gw2shinies.com/api/idbyname/

This API will find all item ids that match your name query. If one item is found, a single array of parameters is returned; if multiple items are found, an array of item objects (also arrays) are returned. If no item is searched, it will return all items with ids+names

Usage
Example, Twilight – http://www.gw2shinies.com/api/idbyname/twilight

If you have any questions or issues, let me know.

http://gw2shinies.com/ – A Guild Wars 2 Trading Post Service
http://gw2tno.com/ – The Nameless Ones [TNO]

(edited by AfterXII.2761)

Item-ID by name?

in API Development

Posted by: Botergios.3014

Botergios.3014

Hey Scree, I wrote this a while ago for guild backend stuff, I hope it finds you well.

http://gw2tno.com/api/finditemidbyname/

This API will find all item ids that match your name query. If one item is found, a single array of parameters is returned; if multiple items are found, an array of item objects (also arrays) are returned. If no item is searched, it will return all items with ids+names

Usage
Example, Twilight – http://gw2tno.com/api/finditemidbyname/twilight

If you have any questions or issues, let me know.

I will have to make an App for Android for one subject at University and I will like to know if I can use it with your permission until ANet makes this functionality available in a few months. We are not allowed to put this apps in the Play Store, just so you can be sure it won’t be against you xD.

Item-ID by name?

in API Development

Posted by: AfterXII.2761

AfterXII.2761

Hey Scree, I wrote this a while ago for guild backend stuff, I hope it finds you well.

http://gw2tno.com/api/finditemidbyname/

This API will find all item ids that match your name query. If one item is found, a single array of parameters is returned; if multiple items are found, an array of item objects (also arrays) are returned. If no item is searched, it will return all items with ids+names

Usage
Example, Twilight – http://gw2tno.com/api/finditemidbyname/twilight

If you have any questions or issues, let me know.

I will have to make an App for Android for one subject at University and I will like to know if I can use it with your permission until ANet makes this functionality available in a few months. We are not allowed to put this apps in the Play Store, just so you can be sure it won’t be against you xD.

Permission granted, thank you for asking.

http://gw2shinies.com/ – A Guild Wars 2 Trading Post Service
http://gw2tno.com/ – The Nameless Ones [TNO]

Item-ID by name?

in API Development

Posted by: Botergios.3014

Botergios.3014

Hey Scree, I wrote this a while ago for guild backend stuff, I hope it finds you well.

http://gw2tno.com/api/finditemidbyname/

This API will find all item ids that match your name query. If one item is found, a single array of parameters is returned; if multiple items are found, an array of item objects (also arrays) are returned. If no item is searched, it will return all items with ids+names

Usage
Example, Twilight – http://gw2tno.com/api/finditemidbyname/twilight

If you have any questions or issues, let me know.

I will have to make an App for Android for one subject at University and I will like to know if I can use it with your permission until ANet makes this functionality available in a few months. We are not allowed to put this apps in the Play Store, just so you can be sure it won’t be against you xD.

Permission granted, thank you for asking.

As I said to you ingame, thank you very much.

Item-ID by name?

in API Development

Posted by: Sariel V.7024

Sariel V.7024

Hey Scree, I wrote this a while ago for guild backend stuff, I hope it finds you well.

http://gw2tno.com/api/finditemidbyname/

This API will find all item ids that match your name query. If one item is found, a single array of parameters is returned; if multiple items are found, an array of item objects (also arrays) are returned. If no item is searched, it will return all items with ids+names

Usage
Example, Twilight – http://gw2tno.com/api/finditemidbyname/twilight

If you have any questions or issues, let me know.

HANDY…. I see it is limited to API items (tested it against some old pvp skins). Since this is http, do you have a way to do a search for something that includes a space?

Item-ID by name?

in API Development

Posted by: smiley.1438

smiley.1438

HANDY…. I see it is limited to API items (tested it against some old pvp skins). Since this is http, do you have a way to do a search for something that includes a space?

urlencode.

http://gw2tno.com/api/finditemidbyname/Gift%20of%20Twilight (a simple + as space doesn’t seem to work)

Item-ID by name?

in API Development

Posted by: AfterXII.2761

AfterXII.2761

HANDY…. I see it is limited to API items (tested it against some old pvp skins). Since this is http, do you have a way to do a search for something that includes a space?

urlencode.

^ this should work as intended. If you find any bugs, let me know.

http://gw2shinies.com/ – A Guild Wars 2 Trading Post Service
http://gw2tno.com/ – The Nameless Ones [TNO]

Item-ID by name?

in API Development

Posted by: AfterXII.2761

AfterXII.2761

APIs have now moved to make way for gw2shinies offerings.

New API link in relation to this post:

http://www.gw2shinies.com/api/idbyname/

Documentation on the gw2shinies site will soon follow

http://gw2shinies.com/ – A Guild Wars 2 Trading Post Service
http://gw2tno.com/ – The Nameless Ones [TNO]

Item-ID by name?

in API Development

Posted by: RAB.7682

RAB.7682

TimeBomb.3427 First off all I would like to thank you for your great instructions. I have put them to use with some javascript, and it works perfectly so far on every item I have tested, except for any chatcodes with the “=” symbol in them. Could you offer any insight into what to do about this = symbol, and how it should be handled/interpreted?

Thank you.

PS: http://rab.rickbrodeur.com/gw2_search_chatcode_to_item_id.html

Item-ID by name?

in API Development

Posted by: RAB.7682

RAB.7682

Forgot to update here, but I got it figured out now.