API:Client code

From MediaWiki.org
Jump to navigation Jump to search
Other languages: English  • 日本語 • русский

Client libraries contain code that developers can use to help with common and basic tasks, so that they don't have to write the code from scratch when their projects interact with an API.

This page contains a set of lists, by language, of up-to three recommended client libraries that can be used with the MediaWiki Action API. The recommendations are based on evaluations using API:Client_code/Gold_standard.

New and/or unevaluated libraries should be added to API:Client_code/All.

API client libraries[edit]

Last activity refers to the last commit in the repository.
Dates and version numbers were updated on 2019-06-19.

Awk[edit]

Name Description Last release Release Date Last activity
BotWikiAwk Framework and libraries for creating bots. Includes example bots. March 27, 2019
Wikiget Awk CLI program to interface with MediaWiki API for read/write including OAuth. June 8, 2019

C++[edit]

Name Description Last release Release Date Last activity
libmediawiki A library that allows easy editing of a wiki through the MediaWiki API. September 9, 2017

Common Lisp[edit]

Name Description Last release Release Date Last activity
cl-mediawiki A Common Lisp wrapper for the Mediawiki API. November 10th, 2016

Go[edit]

Name Description Last release Release Date Last activity
go-mediawiki Go wrapper for the MediaWiki API. v0.1 November 4, 2013 February 8, 2017
go-mwclient Wrapper for the MediaWiki API (supports maxlag, query continuations, OAuth). 1.0.3 August 3, 2018 August 3, 2018

Haskell[edit]

Name Description Last release Release Date Last activity
haskell mediawiki A complete Haskell binding to the MediaWiki API letting you programmatically access (read and write) MediaWiki content. 0.2.6 November 20, 2013 November 20, 2013

Java[edit]

Name Description Last release Release Date Last activity
JavaWikiBotFramework A library to retrieve data from and maintain MediaWiki-based wikis such as Wikipedia. 4.0.0 September 13, 2016 February 15, 2019
jwiki A library for effortlessly interacting with Wikipedia/MediaWiki. 1.7.0 November 2, 2018 June 1, 2019
Bliki Engine Can convert wikicode to HTML, DocBook or PDF. Has a helper library for API calls. April 27, 2019

More Java libraries available at API:Client_code/All#Java.

JavaScript[edit]

Name Description Last release Release Date Last activity
mwbot (Node.js) MWBot uses the Promise pattern and other ES6 methodologies, optimised for creating bots that make edits. Works with any MediaWiki site. v1.0.10 October 30, 2017 February 20, 2019
nodemw (Node.js) A generic MediaWiki API client for Node.js. v0.12.2 September 16, 2018 September 16, 2018
mediawiki.api (browser) Generic MediaWiki API client for client-side JavaScript. It ships with MediaWiki core as a ResourceLoader module bundle. It abstracts some high-level concepts and provides a generic client for other queries. Maintained as part of MediaWiki.

In-wiki JavaScript clients:

Name Description Last release Release Date Last activity
mwapilib2 A layer overtop of the requests. Make JS gadgets easier. September 25, 2016
JsMwApi A convenience wrapper around raw requests, with some helpers for editing and parsing. June 11, 2014

More JavaScript libraries available at API:Client_code/All#JavaScript.

Lua[edit]

Name Description Last release Release Date Last activity
mediawikiapi Makes query (tokens, userinfo), clientlogin, upload, and logout calls. It handles HTTPS requests and cookies and can be used to upload files to Wikimedia Commons. September 20, 2018

MATLAB[edit]

Name Description Last release Release Date Last activity
MatWiki A preliminary (as of Feb 2019) MATLAB R2016b(9.1.x) client supporting just bot-logins & semantic #ask queries. v1.0.0 February 19, 2019 February 19, 2019

.NET[edit]

Name Description Last release Release Date Last activity
AutoWikiBrowser's WikiFunctions library has classes for editing and getting lists of pages via the API. 6.0.0.1 September 15, 2018 June 16, 2019
LinqToWiki Strongly typed library for accessing most of MediaWiki API, with support for autocompletion. 1.5.0 May 7, 2015 May 7, 2015
WikiClientLibrary A .NET Standard & asynchronous MediaWiki API client library for wiki sites. The library also supports Flow/Wikibase/Wikia-specific API. v0.7.0-int.2 May 26, 2019 May 31, 2019

More .NET libraries available at API:Client_code/All#.NET.

OCaml[edit]

Name Description Last release Release Date Last activity
ocaml-mediawiki A high-level binding for the MediaWiki API written in OCaml. August 29, 2012

Perl[edit]

Name Description Last release Release Date Last activity
MediaWiki::Bot A higher-level Perl module with read and write functions. Easily extensible with plugins, for example to provide administrator functions (Evaluation).

source code on Github.

5.006003 July 7, 2016 July 7, 2016
MediaWiki::API A Perl module for interfacing with the MediaWiki API with file upload/download and editing support. (Debian package). (Evaluation). 0.41 November 13, 2015 November 13, 2015

PHP[edit]

Name Description Last release Release Date Last activity
mediawiki-api-base Library for basic MediaWiki api use. 2.4.0 November 2,2017 July 9, 2019
mediawiki-api A simple library for interacting with the MediaWiki API. 0.7.2 November 20, 2017 April 6, 2019
wikibase-api Library for querying Wikidata. 0.7 July 4, 2016 August 17, 2018

More PHP libraries available at API:Client_code/All#PHP.

Sometimes people try to use these kind of libraries to access a MediaWiki installation on the same server. This is often unnecessary because MediaWiki itself is written in PHP, especially when the only purpose of the script is interacting with MediaWiki. By require'ing WebStart.php (MW_INSTALL_PATH may need to be set beforehand, see Manual:$IP), a script gets access to MediaWiki components and consequently it can call the API internally or use other MediaWiki classes and functions directly, which greatly reduces server load.

Python[edit]

Name Description Last release Release Date Last activity
Pywikibot A collection of python scripts and a powerful library for bot writing.(Git repository) (IRC) (Evaluation). 3.0.20190722 July 22, 2019 July 24, 2019
mwclient Python library that makes most of the API functions accessible. (PyPI) (Evaluation). 0.9.3 November 23, 2018 June 10, 2019
wiki-scripts Framework for writing bots, maintenance scripts or performing data analysis. 1.2 December 31, 2017 June 13, 2019

Simple Python wrappers for no-abstraction interfaces to the MediaWiki API and basic session handling:

Name Description Last release Release Date Last activity
pywikiapi A minimalistic library that handles some of the core MediaWiki API complexities like handling continuations, login, errors, and warnings, but does not impose any additional abstraction layers. 1.3.2 April 13, 2019 April 13, 2019
Wikipedia A Python library that makes it easy to access and parse data from Wikipedia. v1.1 December 24, 2013 November 11, 2016
wikitools Provides several layers of abstraction around the API. Doesn't support Python 3. 0.41 June 7, 2015 August 28, 2016

More Python libraries available at API:Client_code/All#Python.

R[edit]

Name Description Last release Release Date Last activity
WikipediR A wrapper for the MediaWiki API, aimed particularly at the Wikimedia 'production' wikis, such as Wikipedia. Can be used to retrieve page text, information about users or the history of pages, and elements of the category tree. 1.5.0 February 15, 2017 February 15, 2017

Ruby[edit]

Name Description Last release Release Date Last activity
MediaWiki::Butt Stable but powerful Ruby framework for the API. (Evaluation) 3.0.0 October 19, 2017 January 3, 2019
wikipedia-client Ruby framework using the API. v1.10.0 March 5, 2018 March 5, 2018
Mediawiki Ruby API Ruby API client library in active development by Wikimedia Foundation Release Engineering. 0.71 January 31, 2017 December 5, 2017

More Ruby libraries available at API:Client_code/All#Ruby.

Rust[edit]

Name Description Last release Release Date Last activity
Wikibase RS Rust library to talk to the Wikibase API and serialize data into Rust data structures. 0.37 June 19, 2019 Jun 19, 2019
mediawiki_rust A MediaWiki client library in Rust. June 23, 2019

More Rust libraries available at API:Client_code/All#Rust.

Scala[edit]

Name Description Last release Release Date Last activity
scalawiki MediaWiki client in Scala. 0.6.0 May 29, 2019 June 23, 2019
dbpedia extraction framework Data extraction framework for DBpedia with support Wiki source retrived via MediaWiki API. DBpedia_2015-10 July 25, 2016 April 13, 2019
scmw Simple MediaWiki API wrapper for needs of Commonist image upload tool. v-0.140.0 December 22, 2017 December 22, 2017

See also[edit]