APIs

From Redazione
Jump to navigation Jump to search

While you are establishing your organization's page structure at an address like the following

https://culturaitaliana.org/wiki/Prestissimo_(Spain)

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 APIs 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 included among the options, the endpoint returns a structured index (either partial, or of the entire site). Optional data for each page include all existing semantic properties, and the detected language.

Example of a GET request

	https://culturaitaliana.org/api/wikipages?title=Istituto_cultura_italiana_(NGO)&options=data|organization_information|index|exclude_hidden

The request queries all the webpages of the organization 'Istituto cultura italiana (NGO)', returns all data of each page, the structured index related to each page of the organization, and will exclude all hidden pages (that is pages unselected in the Frontend index.

Response example


Parameters

keys values notes
title the page title (must include all the path and can be a parent page)
options index|complete_index|data|organization_information
path only required for private wikis, the private wiki username requires a POST request
username only required for private wikis, a username with sysop privileges requires a POST request
password only required for private wikis, the password of related username requires a POST request


Open access APIs

The following endpoints do not require any authentication and they can be queried by anyone.


wikipages

The following endpoint retrieves one or more wiki pages under a specific path. If set among the options, and more than one pages are captured, the endpoint returns a structured index. Optional data for each page include all existing semantic properties, and the detected language.


endpoint

	https://culturaitaliana.org/api/wikipages


urlencoded request (GET)

	path: String (path of relevant wiki),
	title: String (page title),
	organization_id: Integer (can be used instead of title, it is used to retrieve all the pages not belonging to an organization from the public wiki),
	options: index|complete_index|data|organization_information|exclude_hidden (List of values. 'index': include a structured index of retrieved pages; 'complete_index': include a structured index of the entire private wiki or organization to which the retrieved pages belong, 'data': include all data related to each page; 'organization_information': returns the main data of the organization or of the private wiki to which retrieved pages belong; 'exclude_hidden': exclude pages hidden from the index in the pages list
	'username':  String (username of bot or admin account, only for private wikis),
	'password':  String (username of bot or admin account, only for private wikis),


Authentication required APIs

The following endpoints involve confidential data and they require an authentication: typically, they can be used by any registered user in any wiki of this platform (either public or private) with sysop privileges. Just write at redazione@culturaitaliana.org if you want query them from your platform.


sendemail

The following endpoint allows to send an email message, using one of the templates available on the site, to arbitrary lists of recipients including users belonging to groups of the related mediawiki.

endpoint

	https://culturaitaliana.org/api/sendemail


json request (POST)

{
	'path': String (url of related wiki),
	'username': String (username of bot or admin account),
	'password': String (password of bot or admin account),

	'template': String (name of used "pug" template),
	'to' or Array: String (list of recipients, can include one or more wiki groups),
	'cc': String or Array (list of recipients, can include one or more wiki groups),
	'bcc': String or Array (list of recipients, can include one or more wiki groups),
	'locals': Object (keys to be interpolated with values in the related template),

}


sendcode

The following endpoint sends a pin code at the provided email address held by a given property name.

endpoint

	https://culturaitaliana.org/api/sendcode


json request (POST)

{
	'email': String (email address),
	'property':  String (semantic property holding the value)
}