APIs
While you are establishing your organization's page structure at an address like the following
https://culturaitaliana.org/wiki/Centro_italiano_Barcellona
that is structuring all your information optionally using semantic data through this wiki platform, you can start querying your pages (or even all your site) through the following set of APIs, for instance in order to display them in your wordpress site, or in whatever third party site written in any computer language.
The following endpoints do not directly query the standard mediawiki APIs, but an extended APIs built on top of the mediawiki APIs (called autonomously by an internal script which keeps updated all the information) providing additional data, like the detected language for each page, all the semantic data related to each page, the "title structure" (to allow the use of slashes within the title itself, ensuring at the same time the coherence of the hierarchical structure) and more.
Basically, through the following APIs you can query all the information of the created pages or a specific "folder" within it (also retrieving a structured index which can be easily used to create navigation menus, and of course, their html content) without dealing with the complexity and lack of immediacy of the standard mediawiki api, which would require multiple calls and further elaboration to reach that result.
wikipages
The following endpoint retrieves one or more wiki pages under a specific path.
If requested, it also returns a structured index related to the set of returned pages, a useful set of data for each page (including the rendered html, categories, all the related semantic properties, the detected language, the original page url, and more), and information on the related organization.
It is enough flexible to make possible the front-end site corresponding to this set of pages (the link points to itself in the eventuality you are already reading herein), which provides server-side rendering, storage of pages and table of contents within a client-side database, previous/next page navigation, filter of pages based on detected languages, and more: all that using just 2 calls (one server side, and one client side) of the following API !
Examples of API calls
Example request
https://culturaitaliana.org/api/wikipages?title=How_it_works/Technology_we_use&options=data
The request will return only the page set as title, with all data related to it, and the organization information.
Example response
abc
Example request
https://culturaitaliana.org/api/wikipages?root_page=How_it_works&pages=Application_form|Join_team&subpages_data=modification_time|title_structure&options=index|organization_information
The request will return all subpages of the indicated root_page, retrieving only modification_time and title_structure for each of them, and all the available data (including html content) of the pages 'Application_form' and 'Join_team'.
Example response
Example request
https://culturaitaliana.org/api/wikipages?root_page=How_it_works&newer=[timestamp]&options=all_subpages_data
The request will return all the subpages of the indicated root_page newer than the provided timestamp, with all page data for each of them.
Example response
Parameters
keys | description | values | protocol |
---|---|---|---|
wiki | name of the wiki to be queried. Can be omitted for the public wiki) | wiki username | POST |
title | single page to be queried | page title (complete path, with or without underscores) | POST or GET |
root_page | a page title to be queried together with all its subpages | page title (complete path, with or without underscores) | POST or GET |
pages | a list of page titles which will be served with the full set of page data | list of page titles (pipe separated) | suggested POST |
newer | a timestamp less then the last modification time of pages to be retrieved | Unix timestamp | POST or GET |
subpages data | Page data to be retrieved for all subpages of the root_page | one or more of the following: (pipe separated) html, url, language_detected, form_name, form_data, categories, title_structure, modification_time | POST or GET |
options | Query options (see dedicated table below for a description of each option) | one or more of the following: (pipe separated) index, complete_index, data, organization_information, include_hidden | POST or GET |
organization_id | to be used to retrieve all organization pages when the root_page is null (i.e. for private wikis or pages not related to an organization on the public wiki) | the id of the organization returned among the "info" by a previous call of this API | POST or GET |
username | only required for private wikis, a username with sysop privileges | username | POST |
password | only required for private wikis, the password of related username | password | POST |
Options
parameter | description |
---|---|
index | retrieve the index related to the provided root_page |
complete_index | retrieve the complete organization index even if the provided root_page is a subpage of a given organization |
data | retrieve all page's data |
organization_information | retrieve organization information (id and name) |
include_hidden | include pages hidden in the Frontend Index of a given organization |
Returned data for each page
key | description |
---|---|
pageid | wiki page id |
title | page title (without underscores) |
index | page index (starting from 0) as set in the table of contents (the related Frontend Index) |
html | html as rendered by the wiki engine |
url | absolute url of the page |
language_detected | detected language, in the form {"en": "English"} |
form_name | name of the first template/form eventually found in the page |
form_data | set of key/value pairs with form data, complying with our naming conventions |
categories | array of categories |
title_structure | array of titles corresponding to the complete page's path. This allows to use a slash as part of the title at the same time handling the page path correctly |
modification_time | timestamp of last modification time of the page |