Path of Exile Wiki:Data query API
This page contains development information and is intended for developers and not regular end users.
Overview
Just like other wikis the Path of Exile wiki can be accessed through the Mediawiki API. This allows for much faster page editing as well as data retrieval.
In addition cargo can be used to execute powerful queries and retrieve fields from cargo tables. The API documentation can be found here.
Using the API to retrieve Path of Exile data
If you need certain data such as item or mod data for your tools it is highly advised to use the cargo API to retrieve it. It will be much faster then scraping the wiki pages and reduce the overhead significantly on both your script and the wiki server.
When using tables, it's advisable to check the documentation of the module or template that adds the fields. You can also check CargoTables to see cargo tables or hit "Page values" in the Toolbar to see the currently set cargo values on the page.
Cargo data
Following things are exposed via the cargo API (list may be incomplete, please check CargoTables for the full list)
- Items via via Template:Item
- Area data via Template:Area
- Modifier data via Template:Mod
- Version & dates via Template:Version
- Bestiary recipes via Template:Bestiary
- Skill data via Template:Skill
Examples
cargoquery
This will return a json list containing the first 5 distinct names of unique items.
Breakdown:
Querystring | Description | SQL equivalent in query |
---|---|---|
https://pathofexile.gamepedia.com/api.php | Entry point for the API | N/A |
action=cargoquery | Perform a cargo query | N/A |
tables=items
fields=name |
Select name from the table items | SELECT `name` FROM `items`
|
where=rarity=%22Unique%22%20AND%20class=%22Daggers%22 | But only where the field rarity is set to the value unique (e.g. only unique items) and where the field class is set to Daggers (e.g. only items whose item class is set to exactly daggers).
Due to the AND only rows are returned where both conditions are true |
WHERE `rarity`="Unique" AND `class`="Daggers"
|
limit=5 | Only select up to 5 rows | LIMIT 5
|
group_by=name | Group the results by the field name, leaving only one result per distinct value for "name". Essentially, items with the same name (such as the variations of Two-Toned Boots) will only be represented once in the result set | GROUP BY `name`
|
You can search for containment using searches where=name LIKE string.
At the time of writing, running this query will return a json like this:
{ "cargoquery": [ { "title": { "name": "Arakaali's Fang" } }, { "title": { "name": "Bino's Kitchen Knife" } }, { "title": { "name": "Bloodplay" } }, { "title": { "name": "Divinarius" } }, { "title": { "name": "Fragment of Eternity" } } ] }
FAQ
Dealing with multiple tables on the same page
A lot of the wiki is setup with multiple tables that have 1:1 or 1:N relationships. If there isn't any particular key in the table, you generally you want to perform a JOIN query on the two tables, using the hidden row _pageID of both tables.
It's highly advised to check the template documentation about the fields and tables available.