Path of Exile Wiki:Data query API: Difference between revisions

From Path of Exile Wiki
Jump to navigation Jump to search
>OmegaK2
No edit summary
>OmegaK2
No edit summary
Line 5: Line 5:
Just like other wikis the Path of Exile wiki can be accessed through the [[mediawikiwiki:API:Main_page|Mediawiki API]]. This allows for much faster page editing as well as data retrieval.  
Just like other wikis the Path of Exile wiki can be accessed through the [[mediawikiwiki:API:Main_page|Mediawiki API]]. This allows for much faster page editing as well as data retrieval.  


In addition the [[smw:Ask_API|Semantic Mediawiki API]] can be used to execute powerful [[smw:Help:Inline_queries|queries]] and retrieve [[smw:Help:Properties_and_types|properties]] from pages.
In addition [[mediawikiwiki:Extension:Cargo|cargo]] can be used to execute powerful [[mediawikiwiki:Extension:Cargo/Querying_data]] and retrieve fields from cargo tables.


==Using the API to retrieve Path of Exile data==
==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 semantic 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.
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 properties, it's advisable to check the documentation of the module or template that adds them or the page of the property. You can also check the [https://pathofexile.gamepedia.com/Special:AllPages?from=&to=&namespace=102 list of all properties] for some information. There's also [[Special:Browse]] where it is possible to see what properties a page have.
When using tables, it's advisable to check the documentation of the module or template that adds the fields. You can also check [https://pathofexile.gamepedia.com/Special:CargoTables CargoTables] to see cargo tables.


===Items===
===Items===
Line 17: Line 17:
==Examples==
==Examples==


===Browse by subject===
===cargoquery===


To take a look at what properties are available on the an item page you can use [[Special:Browse]] or the API equivalent [[smw:Ask_API#BrowseBySubject|browsebysubject]], for example:
[https://pathofexile.gamepedia.com/api.php?action=cargoquery&tables=items&fields=name&where=rarity=%22Unique%22&limit=5&group_by=name]


https://pathofexile.gamepedia.com/api.php?action=browsebysubject&subject=Rebuke%20of%20the%20Vaal
This will return a json list containing the first 5 distinct names of unique items.
 
This will return a json list containing the properties and their associated values on the page [[Rebuke of the Vaal]]
 
===Askargs===
 
If you just need specific properties from a page you can use [[smw:Ask_API#Askargs|askargs]] - it takes a [[smw:Help:Inline_queries|ask queries]] and [[smw:Help:Properties_and_types|properties]] as arguments, for example:
 
https://pathofexile.gamepedia.com/api.php?action=askargs&conditions=Has%20rarity::Unique|Has%20base%20item::Imbued%20Wand&printouts=Has%20name
 
This has a query with two conditions, it searches for any items that have the [[unique]] [[rarity]] (<code>Has rarity::Unique</code>) and that have a base item with the name "Imbued Wand" (<code>Has base item::Imbued Wand</code>). 
 
For any results found, it will print out [[Property:Has name]].


[[Category:Tutorials]]
[[Category:Tutorials]]

Revision as of 22:35, 10 February 2018

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 mediawikiwiki:Extension:Cargo/Querying_data and retrieve fields from cargo tables.

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.

Items

All items on the wiki are exposed by Template:Item and are fully powered by semantic media wiki - this means you can query just about any property of an item to create convenient item lists.

Examples

cargoquery

[1]

This will return a json list containing the first 5 distinct names of unique items.