Since we now have a dedicated spot for API discussions, I figured I would take the liberty of sharing what I know about the Trading Post / Gem Store API so that anyone interested in making something with it will have a thorough reference to go off of. Thanks to all the people in the #gw2spidy chatroom who showed me much of this.
DISCLAIMER: This API is not an official-release API and is not intended for public use. Therefore, it is unsupported by Arenanet, NCsoft or any other company. It is subject to change without any notification. USE AT YOUR OWN RISK.
Web addresses involved:
- https://tradingpost-live.ncplatform.net – trading post page
- https://gemstore-live.ncplatform.net – gem store page
- https://exchange-live.ncplatform.net – gem exchange page
Accessing the Trading Post:
The external login page is /authenticate after one of the above address:
- https://tradingpost-live.ncplatform.net/authenticate
- https://gemstore-live.ncplatform.net/authenticate
- https://exchange-live.ncplatform.net/authenticate
These pages use a fairly standard SSO (Single Sign On) setup, so if you are already logged into the forum, it will check against the forum and automatically redirect you to that particular site’s landing page. If you are not logged in, it will redirect you to account.guildwars2.com so you can enter your information. If you already have a valid session ID, you can add it as a parameter: <site>/authenticate?id=<session-id>
If, like me, you are trying to access these parameters outside of a web browser and don’t retain cookies, you can add the session-id in the form of s=<session-id> as a custom header called Cookie (this is how cookies are automatically passed in a browser) whenever you make an API call.
Note that session-ids do expire, and you will need to update these regularly or finding a way of retrieving a new one automatically as necessary.
tradingpost outputs:
- https://tradingpost-live.ncplatform.net/ws/search.json
This output is the one that does the majority of functions on the TP. By default it won’t return anything as it requires a combination of different parameters depending on what you are trying to accomplish. - ?text=&levelmin=0&levelmax=80
This combination will return a list of all the items along with their buy and sell listings and prices. By default this only returns 10 items at a time, but this is adjustable by the count= parameter. If count=0 it will return all of the items in the list. The offset= parameter starts the listing based on that number in the list (1 is the first item) The text= can be filled in to filter by the item name, but leaving it blank is still valid. levelmin and levelmax require valid numbers to be entered. Other filters that are optional are removeunavailable=true, rarity=, type=, and subtype= (these last 3 require their numeric representation, not characters). WARNING: This can pull in ALL ITEMS and can take a long time to run and take a great deal of memory to process - ?text=text&typeahead=1
This combination returns just the type, id, and name of an item. This is what is called when you type something into the search box and it gives you a list of items. It requires some sort of text to be entered to work. The count=0 trick works on this as well, and you can use offset= as well. Optional parameters levelmin, levelmax, removeunavailable, rarity, type, and subtype all function the same as above. - ?ids=27321,24354
This allows you to enter a comma delimited list of item ids (up to 250) and pull in the same info as you do from the first set of parameters. All of the other parameters are rendered inoperable when this parameter is specified.
Continued in next post…
Fun on someone else’s schedule is not fun
(edited by The Talcmaster.7391)