Proxy-layer server for the official GuildWars 2 API.
🚧 Please note that this is not versioned and stuff may change without notice. 🚧
- Requirements:
# Clone the repository and build the worker and server files
git clone https://github.com/gw2efficiency/gw2-api.com
cd gw2-api.com/
npm install
npm run build
# Start a server cluster with 10 processes
pm2 start build/server.js --name="gw2api-server" -i 10
# Start the background worker
pm2 start build/worker.js --name="gw2api-worker"
Note: Requires a running instance of mongodb and will execute on a test database
npm test
/item/:id
/items/:ids
/items/all
/items/all-prices
/items/autocomplete
/items/by-name
/items/by-skin
/items/query
/items/categories
/skins/resolve
/skins/prices
/recipe/nested/:id
/gems/history
This endpoint returns a single item.
Parameters
id
: An item id, either in the url or as a GET/POST parameterlang
(optional): The requested language (defaults to english)
{
"id": 123,
"name": "Zho's Mask",
"level": 80,
"rarity": 5,
"image": "https://...",
"category": [
0,
3
],
"vendor_price": 330,
"buy": {
"quantity": 94,
"price": 4852,
"last_change": {
"time": "2015-06-09T05:55:44+0000",
"quantity": 1,
"price": 1
}
},
"sell": {
"quantity": 378,
"price": 7635,
"last_change": {
"time": "2015-06-09T00:04:59+0000",
"quantity": 16,
"price": -140
}
},
"crafting": {
"buy": 1337,
"sell": 4242
},
"last_update": "2015-06-09T05:55:44+0000"
}
This endpoint returns an array of items.
Parameters
ids
: An array or a comma separated list of one or more item ids, either in the url or as a GET/POST parameterlang
(optional): The requested language (defaults to english)
[
{
"id": 123,
"name": "Zho's Mask",
// like /item/:id ...
},
// ...
]
This endpoint returns an array of all tradable items.
Parameters
lang
(optional): The requested language (defaults to english)
[
{
"id": 123,
"name": "Zho's Mask",
// like /item/:id ...
},
// ...
]
This endpoint returns an array of all tradable item ids with their prices.
Parameters
lang
(optional): The requested language (defaults to english)
[
{
"id": 123,
"price": 1337
},
// ...
]
This endpoint returns an array of up to 20 items best matching the search query.
Parameters
q
: The term to search for in the item nameslang
(optional): The requested language (defaults to english)
[
{
"id": 123,
"name": "Zho's Mask",
"level": 80,
"rarity": 5,
"image": "https://..."
},
// ...
]
This endpoint returns an array of all items matching the name exactly (case-sensitive!).
Parameters
names
: An array or a comma separated list of one or more item names, as a GET/POST parameterlang
(optional): The requested language (defaults to english)
[
{
"id": 123,
"name": "Zho's Mask",
// like /item/:id ...
},
// ...
]
This endpoint returns an array of all item ids matching the skin id.
Parameters
skin_id
: An skin id, as a GET/POST parameter
[
123,
124,
125,
// ...
]
This endpoint returns all items matching the query.
PLEASE DO NOT USE THIS HEAVILY Please note that this endpoint is not as optimized as the others, since it should never be used directly user facing. This is supposed to be only used for server-side tasks that run every once in a while.
Parameters
categories
: Semicolon separated list of category ids that the queried items must matchrarities
: Semicolon separated list of rarities that the queried items must matchcraftable
: If set to any value, queried items must be craftableexclude_name
: Queried items must exclude this string in their nameinclude_name
: Queried items must include this string in their nameoutput
: If set, returns a object with price information across all matches instead of item ids
// output not set
[
123,
124,
125,
// ...
]
// output "prices"
{
"buy": {
"min": 123,
"avg": 456,
"max": 789
},
"sell": {
"min": 123,
"avg": 456,
"max": 789
}
}
This endpoint returns an array of the item categories that are used as identifiers for the other item endpoints.
{
"Armor": [
0,
{
"Boots": 0,
"Coat": 1,
"Gloves": 2,
"Helm": 3,
"HelmAquatic": 4,
"Leggings": 5,
"Shoulders": 6
}
],
"Back": [
1
],
"Bag": [
2
],
// ...
}
This endpoint returns a list of all skin ids with their respective item ids.
{
"1": [2902,2903 /* ... */],
"18":[2534,2535,2557 /* ... */],
// ...
}
This endpoint returns a list of all buyable skin ids with their respective cheapest item price. (Note: the item price itself is the highest of buy price, sell price and vendor price)
{
"1": 123,
"18": 456,
// ...
}
This endpoint returns a nested recipe for that item (if a recipe exists). All components that can be crafted include their respective recipe and subcomponents.
Parameters
id
: An item id, either in the url or as a GET/POST parameter
{
"id": 31083,
"output": 1,
"quantity": 1,
"components": [
{
"id": 20852,
"quantity": 1
},
{
"id": 13243,
"quantity": 5,
"output": 1,
"components": [/* ... */]
},
// ...
]
}
This endpoint returns price history data for gold to gems conversion.
{
"gold_to_gem": [
[
1347314400000, // timestamp in ms
2747 // Conversion price (27s 47c per bought gem)
],
[1347400800000,2735],
// ...
],
"gem_to_gold": [
[
1347314400000, // timestamp in ms
1965 // conversion price (19s 65c per sold gem)
],
[1347400800000,1956],
// ...
]
You can find the old PHP version before the rewrite under the v0.1 release tag.
Past
In the old days, before the official API, you could get item and price data by requesting a session token from the official login page and then using the urls the tradingpost used ingame as a unofficial API.
This project originated when I wanted to this data for a tradingpost section on gw2efficiency.com, but I was not satisfied with the existing solutions (mainly because of cache time, update frequency and data format).
Present
Now, gw2efficiency.com still depends on this project and gets item data from gw2-api.com, even tho the official API has gotten many more endpoints and a lot of things could be requested directly from it. Sadly in the way this page was written in PHP, it takes way too many resources to serve the millions of requests it gets every day.
To fix this, and to extract re-usable modules that can get used for gw2efficiency.com as well, this project has been rewritten in node.js with resource management and performance in mind.
Future
In the future, gw2-api.com will stay online for a while, but it will not be used in production anymore. Instead, it will be integrated into the API of gw2efficiency.com directly.
AGPL