PCGamingWiki:API

From PCGamingWiki, the wiki about fixing PC games
Revision as of 20:30, 11 November 2020 by Aemony (talk | contribs) (updated API examples)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

API

This page might not be updated to reflect all available API endpoints or functionality.


MediaWiki API

As the PCGamingWiki is based on MediaWiki, the built-in MediaWiki API endpoint can be used to access a lot of data. Some MediaWiki extensions we use such as Semantic MediaWiki and Cargo also exposes their own API actions through the MediaWiki API.
If you want to retrieve the Semanic MediaWiki properties (e.g. cover image, developer, publisher, release date, etc) of a page, the browsebysubject API action is currently the most relevant one if you know the page name. See this example (sandbox).
The API Sandbox can be helpful in figuring the API out.


Examples:

Find PCGW page(s) using the SMW property Steam AppID:
https://www.pcgamingwiki.com/w/api.php?action=askargs&conditions=Steam_AppID::863550&format=jsonfm
Retrieve all populated SMW properties for a single page:
https://www.pcgamingwiki.com/w/api.php?action=browsebysubject&subject=Hitman_2&format=jsonfm
  • Hitman_2 was retrieved using the previous example query.
  • #0# at the end of the subject key represents the MediaWiki namespace the page resides under, see the siteinfo API action for the details. #0# refers to the main namespace of the site.
Retrieve specific populated SMW properties for a single page retrieved using the the SMW property Steam AppID:
https://www.pcgamingwiki.com/w/api.php?action=askargs&conditions=Steam+AppID::863550&printouts=4K_Ultra_HD%7CUltra-widescreen%7CPublished_by&format=jsonfm


Redirect API

Our custom redirect API allows us to redirect incoming users using any registered GOG ID, Steam App ID, or WineHQ ID to the relevant PCGamingWiki page.
Source code


Examples:

GOG ID:
https://www.pcgamingwiki.com/api/gog.php?page=1785384169
Steam App ID:
https://www.pcgamingwiki.com/api/appid.php?appid=674020
WineHQ:
https://www.pcgamingwiki.com/api/winehq.php?appid=15482