We’ve just turned on our second authenticated endpoint! It allows players to delegate access to their current and historical Black Lion Trading Post transactions (basically everything that’s shown in the “My Transactions” tab of the in-game Trading Post). There’s more details available in the CDI thread, but for posterity I’ll post some example request/responses.
It’s important to note that all URLs provided by this endpoint require an API key with the “tradingpost” permission.
The first two levels of the URL basically just point to what’s available on lower levels (for self-discovery purposes):
GET /v2/commerce/transactions HTTP/1.1
Authorization: Bearer insert-token-here
HTTP/1.1 200 OK
Content-Type: application/json
[
"current",
"history"
]
Both “current” and “history” endpoints provide separate lists for “buys” and “sells” — due to technical constraints it’s infeasible for us to collate them meaningfully.
GET /v2/commerce/transactions/current HTTP/1.1
Authorization: Bearer insert-token-here
HTTP/1.1 200 OK
Content-Type: application/json
[
"buys",
"sells"
]
Finally, the meat of the endpoint is a paginated list of the last 90 days of transactions (unfortunately, older transactions aren’t available). In the response headers there’s data about the total result set, as well as an RFC5988 Link header. As usual, pagination is controlled via the page
and page_size
URL parameters.
GET /v2/commerce/transactions/history/buys?page_size=2 HTTP/1.1
Authorization: Bearer insert-token-here
HTTP/1.1 200 OK
Content-Type: application/json
X-Page-Size: 2
X-Page-Total: 143
X-Result-Count: 2
X-Result-Total: 286
Link: , </v2/commerce/transactions/history/sells?page=0&page_size=2>; rel=self, </v2/commerce/transactions/history/sells?page=0&page_size=2>; rel=first, </v2/commerce/transactions/history/sells?page=142&page_size=2>; rel=last
[
{
"id": 2757359846,
"item_id": 44971,
"price": 19998,
"quantity": 1,
"created": "2015-05-12T06:36:12+00:00",
"purchased": "2015-05-12T16:55:14+00:00"
},
{
"id": 2756695824,
"item_id": 24713,
"price": 425,
"quantity": 1,
"created": "2015-05-12T06:35:33+00:00",
"purchased": "2015-05-12T08:36:50+00:00"
}
]
In the actual body, it’s important to note that the id
field does not necessarily correspond when an order is filled (and thus moves from “current” to “history”). This is mostly because for e.g. a sale of 50, there may be multiple buy orders at different dates.
Another constraint to be aware of is that cancelled orders are basically removed from the list. There’s not a clean way right now to discern between a cancelled and filled order, but since only commodities can be traded, it likely isn’t a huge deal.
Finally, the “purchased” field is omitted for the “current” endpoint, since those orders haven’t yet been filled.
Anyway, if you’ve got any questions/concerns post ‘em here and I’ll do my best to address ’em.
EDIT: Also, there’s a 5 minute cache on responses, so you don’t need to poll it that often.
(edited by Lawton Campbell.8517)