Mystic’s Gold Profiting Guide
Forge & more JSON recipes
I can’t find any mention of how to get item_details or recipe_details with v2, do we still use v1?
such as https://api.guildwars2.com/v1/recipe_details.json?recipe_id=200
On a different topic, gem prices. Why do the coins_per_gem change depending on the quantity requested? I know they would change as the price changes, but this is too much, and is predictable (smaller the quantity, larger the price):
https://api.guildwars2.com/v2/commerce/exchange/coins?quantity=10000000
quantity_in_url = coins_per_gem
10000000 = 1279
1000000 = 1277
100000 = 1279
10000 = 1380
8000 = 1502
7000 = 1288
6000 = 1341
5000 = 1431
4000 = 1610
3000 = 2147
hmmmm. I decided to check the in-game gem exchange. It looks like it costs 21s57c to buy 1 gem, and 2g16s12c to buy 17 gems (12s71c per gem). I guess that explains why the api would give those numbers, but why does buying single-digit amounts of gems cost up to 70% more per gem than double-digit?
You can still use v1 for now. The data that v2 will return should be the same. Only the response format will be different. Consider converting incoming response data to custom class layouts that are reusable for v2 when that becomes available.
The /v2 api combines the /v1/items.json & /v1/item_details.json APIs into a single, simpler API. You can look a /v2/commerce/listings for an example of the behavior. Requesting the root of /v2/items returns a list of all item IDs, exactly like /v1/items.json. You can then request for /v2/items/<id> or use any of the other querying mechanisms like ?ids=<id>,<id>,<id> or pagination to get individual item details.
Will the json schema for item details change at all? Or will it be the same as v1, but with added support for bulk requests and pagination?
Will the json schema for item details change at all? Or will it be the same as v1, but with added support for bulk requests and pagination?
Very similar, but we’ve fixed some types & done some of the work for you in terms of turning items into icons.
Way more interesting would actually be the [item_type] part (hope you also changed the naming of that because it was a pain to “guess” the right identifier for that subobject).
Example:
https://api.guildwars2.com/v1/item_details.json?item_id=49412
Way more interesting would actually be the [item_type] part (hope you also changed the naming of that because it was a pain to “guess” the right identifier for that subobject).
Example:
https://api.guildwars2.com/v1/item_details.json?item_id=49412
Nope, sorry. That’s still passed-through as-is. Only difference is that we send back numbers as numbers instead of strings.
Will the json schema for item details change at all? Or will it be the same as v1, but with added support for bulk requests and pagination?
Very similar, but we’ve fixed some types & done some of the work for you in terms of turning items into icons.
Thanks for the info! Have you also fixed armor/weapon bonus for boon duration and condition duration that are listed inside “buff” instead of “attribute”?
Way more interesting would actually be the [item_type] part (hope you also changed the naming of that because it was a pain to “guess” the right identifier for that subobject).
Example:
https://api.guildwars2.com/v1/item_details.json?item_id=49412Nope, sorry. That’s still passed-through as-is. Only difference is that we send back numbers as numbers instead of strings.
Oh, that isn’t too bad at all, though. Thanks for the info! However, any chance to get that subobject renamed in a more common way, something like “item_details” (or “itemDetails” in correct camelCase) or just “details”?
(edited by smiley.1438)
Way more interesting would actually be the [item_type] part (hope you also changed the naming of that because it was a pain to “guess” the right identifier for that subobject).
Example:
https://api.guildwars2.com/v1/item_details.json?item_id=49412Nope, sorry. That’s still passed-through as-is. Only difference is that we send back numbers as numbers instead of strings.
Oh, that isn’t too bad at all, though. Thanks for the info! However, any chance to get that subobject renamed in a more common way, something like “item_details” (or “itemDetails” in correct camelCase) or just “details”?
I misunderstood your question, sorry. It’s been standardized to “details”. I updated the gist w/ examples of the item you used.
Brilliant! Thank you!
Way more interesting would actually be the [item_type] part (hope you also changed the naming of that because it was a pain to “guess” the right identifier for that subobject).
Example:
https://api.guildwars2.com/v1/item_details.json?item_id=49412Nope, sorry. That’s still passed-through as-is. Only difference is that we send back numbers as numbers instead of strings.
Oh, that isn’t too bad at all, though. Thanks for the info! However, any chance to get that subobject renamed in a more common way, something like “item_details” (or “itemDetails” in correct camelCase) or just “details”?
I misunderstood your question, sorry. It’s been standardized to “details”. I updated the gist w/ examples of the item you used.
Ok, I saw that the answer for my previous question is no, and I can understand why.
From your last example ( API v2), I can see that “suffix_item_id” is not present but “secondary_suffix_item_id” is present (but empty). I suppose that “suffix_item_id” is not present because Trinket don’t have a slot for rune/sigil, but why “secondary_suffix_item_id” is still present?
I’ve always wanted to know why an item’s combat attributes is a collection instead of an object. Don’t you store each attribute as a separate table column?
Can items have multiple inherent attributes of the same type? Even if so, why not add them together?
To clarify, this would make more sense to me:
"attributes": {
"Power": 33,
"Precision" : 33,
"Toughness" : 33,
"Vitality : 33,
"Healing" : 33,
"ConditionDamage" : 33,
"CritDamage" : 33
}
(edited by StevenL.3761)
The /v2 api combines the /v1/items.json & /v1/item_details.json APIs into a single, simpler API. You can look a /v2/commerce/listings for an example of the behavior. Requesting the root of /v2/items returns a list of all item IDs, exactly like /v1/items.json. You can then request for /v2/items/<id> or use any of the other querying mechanisms like ?ids=<id>,<id>,<id> or pagination to get individual item details.
I see that https://api.guildwars2.com/v2/commerce/listings returns a list of all Item ID’s
Should this be the same list of items as /v1/items.json ? Looks like v2/commerce/listings has 22,125 Items, while v1/items.json has 37,817 Items.
But https://api.guildwars2.com/v2/items/12138 just says "{"text":“API not active”}"
same for https://api.guildwars2.com/v2/items?id=12138
maybe it’s not implemented yet, or I’m reading the example wrong?
Yeah experiencing the same issue. Wanted to make multiple requests but v1 doesn’t seem to support it…
/commerce/listings only returns identifiers for items that are currently listed on the trading post. That explains why there are well over 15000 identifiers missing from the listing service.
What it doesn’t expain is why there are item identifiers in the listing service that are not in the items.json service?!
example:
https://api.guildwars2.com/v2/commerce/listings/9102
https://api.guildwars2.com/v1/item_details.json?item_id=9102
edit
Mystery solved. You can place bids for that item on the trading post, but nobody actually has it. Only discovered items appear in the items service.
(edited by StevenL.3761)
The /v2/items API doesn’t know about 9102 either. I wonder if the /v1 API feeding it hasn’t been updated correctly? Not something I’ve got a hand in so tough to answer.
/v2/items API isn’t active yet as we’re still polishing up some bits. I’m just providing examples to hopefully answer questions and maybe unblock folks that are writing libs that want to consume /v2 APIs.
It looks to me as if these items are not supposed to be listed on the trading post. I converted some of the identifiers to chat links and pasted them in-game to see what item they correspond to. Items include things like “Cinematic Weapon Sword Charr”.
[&AgGOIwAA]
[&AgGjPQAA]
[&AgFhSQAA]
[&AgEoSgAA]
[&AgFLWgAA]
[&AgFPWgAA]
[&AgFgYQAA]
[&AgF1YQAA]
[&AgF/ZAAA]
[&AgGQZAAA]
[&AgGSZAAA]
[&AgGVZAAA]
[&AgGXZAAA]
[&AgFKcgAA]
[&AgEAdQAA]
[&AgEIdQAA]
[&AgEMdQAA]
[&AgEWdQAA]
[&AgGJeQAA]
[&AgGQeQAA]
[&AgGUeQAA]
[&AgGXeQAA]
[&AgGaeQAA]
[&AgGbeQAA]
[&AgGceQAA]
[&AgGdeQAA]
[&AgGfeQAA]
[&AgGgeQAA]
[&AgGheQAA]
[&AgGjeQAA]
[&AgGkeQAA]
[&AgGoeQAA]
[&AgGpeQAA]
[&AgG/eQAA]
[&AgHAeQAA]
[&AgHBeQAA]
[&AgHHeQAA]
[&AgHKeQAA]
[&AgECfgAA]
[&AgE1jgAA]
[&AgE3jgAA]
(edited by StevenL.3761)
There are actually a lot of questionable items on the TP. Items that are either soul- or account bound or like the one you discovered, items which are not meant for player use. Seems like there are (or hopefully “were”) a couple of bugs in there so that one could list invalid items – most likely through “inofficial” TP API use.
Yeah, we chatted about it some internally and have a hypothesis. There was a bug around launch that let you place buy orders for items before they’d ever been “discovered” (sold). Folks were using our unsupported web service endpoints in the TP to place buy orders by incrementing item IDs blindly, so there’s all sorts of weird gunk on there now.
Commerce team is looking at how hard it’d be to clean that stuff up because it’s just cluttering things and making for weird situations like this. Since those items have never been discovered in-game (unsurprising, given that they’re internal-only NPC things) the items endpoint doesn’t know anything about them. That disconnect sucks, so we’d like to clean it up.
I have a stupid question, will there be a way to search for items or do we still have to download the whole database to do any meaningful search?
will there be a way to search for items
Given the current information i’d say “no”. I wish we had something for the maps/map_floor endpoints, though.
A few, most of /v2 is just exposing existing /v1 data in a cleaner & more useful way. We’ll keep adding new APIs as they make sense to it, but don’t expect seismic shifts in the data you can get out.
will there be a way to search for items
Given the current information i’d say “no”. I wish we had something for the maps/map_floor endpoints, though.
A few, most of /v2 is just exposing existing /v1 data in a cleaner & more useful way. We’ll keep adding new APIs as they make sense to it, but don’t expect seismic shifts in the data you can get out.
Well, it doesn’t change the data, it would expose it in a cleaner & more useful way :P
We could expose the commerce search endpoint, but it only knows about items that can be put on the Trading Post. We don’t have any other search backends wired up to items that I’m aware of.
We could expose the commerce search endpoint, but it only knows about items that can be put on the Trading Post. We don’t have any other search backends wired up to items that I’m aware of.
This would be helpful too – at least for people who want to build their own TP listings.
Anyway, having an “own” database makes it easier to play around and keep track of changes. That being said: any chance on an endpoint which lists the ids of changed items after a patch has been pushed?
We could expose the commerce search endpoint, but it only knows about items that can be put on the Trading Post. We don’t have any other search backends wired up to items that I’m aware of.
That’s better than nothing, also what Smiley said would be useful, I could make the initial download for the whole database, and then just do proper upgrades.
any chance on an endpoint which lists the ids of changed items after a patch has been pushed?
It’s not something we have currently, and I don’t think it’s anything we’re planning to build. Hopefully once /v2/items is out it’ll be easier for people to compile those sorts of things themselves.
any chance on an endpoint which lists the ids of changed items after a patch has been pushed?
It’s not something we have currently, and I don’t think it’s anything we’re planning to build. Hopefully once /v2/items is out it’ll be easier for people to compile those sorts of things themselves.
Thanks for the heads up!
I wonder how that process would be easier with v2 since it basically delivers the same data. Currently the only way to find and update changed items is to retrieve the info for each and every item over and over. So the only advantage of v2 will be the bulk request which may speed up this process (which currently takes about a day).
€: see also: https://forum-en.gw2archive.eu/forum/community/api/API-Suggestion-Items-Recipes-and-Crafting/2863618
(edited by smiley.1438)
I wonder how that process would be easier with v2 since it basically delivers the same data. Currently the only way to find and update changed items is to retrieve the info for each and every item over and over. So the only advantage of v2 will be the bulk request which may speed up this process (which currently takes about a day).
That’s what I’m referring to, yes. Getting back 200 items at a time is going to speed up that process.
Feature request: could you add a response header ‘X-Build’ that represents the current game build number?
We already have /v2/build (& /v1/build.json) which returns that info. Why do you want it w/ every request?
The only way this information would make sense with each request would be for the item details, like build_introduced and build_changed so that we could keep track of these. But i guess thats over the top anyway…
I’m a little paranoid about the build number changing while I’m updating my database. My workflow now is to get the build number, then retrieve a batch of items, then verify that the build number hasn’t changed. Only if the build hasn’t changed can I be sure that each item was assigned the correct build identifier. If it did change, I have to discard that batch.
I’ll think about it, but it’s not going to be a high priority compared to getting the rest of the /v2 APIs enabled.
Currently the only way to find and update changed items is to retrieve the info for each and every item over and over. So the only advantage of v2 will be the bulk request which may speed up this process (which currently takes about a day).
The bottleneck here at the moment is the completion of the request. If you thread your requests it goes significantly faster. The script that builds the recipe list for my website grabs every individual recipe(num_recipes/10_x_num_procs at a time), and (currently 7228) craftable item details in 4 languages. And completes in about 3-5 minutes depending on network traffic.
https://github.com/xanthics/gw2craft/blob/master/Create_recipes.py
Threading is the bomb. I’m currently running on my work laptop – not the most powerful beast in the world (Core i5-3210M @ 2.50 GHz), but the LAN has very fat bandwidth. I’m using my custom Perl module posting to a MySQL database.
(edited by Dr Ishmael.9685)
I was tempted to say thats hard to do in PHP due to the lack of multi threading, but hey, it isn’t (there is an extension but it’s nothing to rely on: http://php.net/pthreads). I built the updater around this example: https://gist.github.com/Xeoncross/2362936 and it looks promising – ok, it isn’t multi threaded but at least asynchronous.
(edited by smiley.1438)
I’ve used https://code.google.com/p/rolling-curl/ in the past with success, looks like it might be a similar implementation.
gw2spidy uses https://github.com/jmathai/php-multi-curl which seems to be yet another implementation
I’ve used https://code.google.com/p/rolling-curl/ in the past with success, looks like it might be a similar implementation.
It’s in fact based on the same implementation by Josh Fraser: http://www.onlineaspect.com/2009/01/26/how-to-use-curl_multi-without-blocking/
€:
Just did a couple test runs with 1000 requests (250 items) which have been completed in ~72 seconds on a very slow connection, would be in total about 3 hours, assuming 38k items (152k requests).
(edited by smiley.1438)
How many requests out of 1000 does it send and post-process at a time? Would you be able to queue up all 1000 requests at the same time, then handle each one as it completes?
My understanding is that the total duration should approach the sum of (the time it takes to queue all requests) plus (the time of the slowest HTTP query). How does it still take over a minute? (honest question)
(edited by StevenL.3761)
I’ve tested it and it’d be able to do so. But there’s 2 problems:
first: it’ll blow up your cpu and memory
second: there may be a limit of concurrent connections to the same host or you might get blocked when you’re hammering too hard, so there’s a limit which you can specify
The first example which i’ve posted works basically like that – no limits, just hammering. The one Pat posted has those limitations built in, one might use this for production.
Y U EDIT WHILE I ANSWER?
The total duration is just approx, mileage may vary. I’m currently rewriting my database updater, so i can maybe give you real results tomorrow.
(edited by smiley.1438)
Forget about /v1, show us the numbers for /v2/items. The new APIs seem fast enough to not require asynchronous code, but I’m curious to see how far it can be pushed.
36 minutes on my connection for a full update (4 languages) – while downloading chunks of just 50. I guess it’ll be done in a few minutes on darthmaim’s server then (gw2treasures.de). I ran a v1 update before just for testing and it was like i predicted ~ 3 hours.
36 minutes on my connection for a full update
I’m down to 2 minutes for a single language now… ;D
36 minutes on my connection for a full update
I’m down to 2 minutes for a single language now… ;D
You can have my connection – 3 times dual channel ISDN… you know how “fast” that is, right?
36 minutes on my connection for a full update (4 languages) – while downloading chunks of just 50. I guess it’ll be done in a few minutes on darthmaim’s server then (gw2treasures.de). I ran a v1 update before just for testing and it was like i predicted ~ 3 hours.
?page_size=200 is very useful here.
I’ve tested with 50 and 200, but 200 took way too long on the initial download. I can live with a full database refresh in half an hour – thats nothing compared to the old version
Darthmaim’s server has at least a 1Gbit connection (if not 10Gbit+) – not much of a problem there.
(WIP already on github: https://github.com/codemasher/gw2-database/blob/master/classes/gw2items.class.php#L156)
(edited by smiley.1438)
v2/items is great to work with
I assume v2/recipes is on it’s way?
Not affiliated with ArenaNet or NCSOFT. No support is provided.
All assets, page layout, visual style belong to ArenaNet and are used solely to replicate the original design and preserve the original look and feel.
Contact /u/e-scrape-artist on reddit if you encounter a bug.