rubensayshi / gw2spidy

GW2Spidy - Guild Wars 2 Tradingpost Graphs
http://www.gw2spidy.com
231 stars 86 forks source link

Ingredients in recipe_details #149

Open 0x8DEADF00D opened 10 years ago

0x8DEADF00D commented 10 years ago

I'm in need of a field in all-recipes providing the ingredients of a recipe. Currently I'm querying all-recipes first and use the data_id to request the official gw2 API in order to get the recipe and the associated ingredient id's.

Due to the lack of multirequesting (multiple recipes at once) the process of querying is very slow since I need to make a request once per recipe.

rubensayshi commented 10 years ago

there's an (undocumented) API endpoint for all recipes; http://www.gw2spidy.com/api/v0.9/json/all-recipes/all

/all can be replaced by /<discipline_id>

0x8DEADF00D commented 10 years ago

Hi and thank you for your answer but the link you provided is basically the same as /recipes/all and does not give me the ingredients needed to craft this item. I only get the recipe itself and the result of crafting it.

rubensayshi commented 10 years ago

if you'd get /all-items/ too and store both in an internal database / cache you can easily combine the two without needing to do a lot of API calls right?

0x8DEADF00D commented 10 years ago

No I can't because neither /all-items/ or /all-recipes/ is holding a reference to the ingredient id's. The thing is that your API does only return the data id of the result, not all ingredients.

The official API is returning an array of item id's representing the ingredients of the recipe:

"ingredients": [
    { "item_id": "19797", "count": "1" },
    { "item_id": "13094", "count": "1" },
    { "item_id": "13093", "count": "1" }
  ]

which is nice but sadly you need to query the recipe details for each recipe and that sucks. I'd like to have that in your API combined with /all-recipes/ , I think that this will be a nice enhancement (not only for me)

Zyles commented 9 years ago

I would like to see this as well: If I understand the OP correctly.

Looking at this page: http://www.gw2spidy.com/recipe/7534

At the bottom you have a big list of all ingredients in a multidimensional array. This is what I would like in one API call, instead of doing nested looping for every single item. That would save you a lot of API requests right?

I basically want all the base ingredients needed to craft a particular item.