API:Client code

API Access Libraries
 Notes to library developers


 * Please use GZip compression when making API calls.
 * Bots eat up a lot of bandwidth, which is not free.


 * You must set a descriptive User Agent header
 * Please include your username and wiki or email address.


 * You should attempt to minimize the number of API calls by asking for multiple items in one request. Use  and get all the needed lists and properties at the same time. Only ask for what you actually need.
 * We are planning to migrate to JSON-only API, removing all other formats like XML, YAML, and PHP.
 * When querying, use the new continue parameter. (March 2013)

Bash

 * See API:Client_code/Bash. Requires curl package.Smallman12q (talk) 00:02, 7 January 2013 (UTC)

C++

 * libmediawiki. There is a tutorial in KDE TechBase.

Clojure

 * cloki

Common Lisp

 * cl-mediawiki is a Common Lisp wrapper for the mediawiki API. It is available as a direct download, or (more conveniently) via quicklisp.

Delphi/Object Pascal

 * MediaWiki API Wrapper, based on ICS open-source sockets, with synchronous and asynchronous (event based) requests, requires the JEDI Code Library for dependencies.

Go

 * go-mediawiki Go wrapper for the MediaWiki API
 * go-mwclient another Go wrapper for the MediaWiki API (supports maxlag)

Haskell

 * http://hackage.haskell.org/package/mediawiki

Java

 * Bliki Engine - Java Wikipedia API - very complete. Can convert wikicode to HTML, DocBook or PDF.
 * JavaWikiBotFramework - a Java library that makes almost all API functions accessible.
 * Wiki.java — a simple one-class API implementation
 * WPCleaner — a Java editing tool that includes a package for MediaWiki API.

JavaScript

 * https://github.com/macbre/nodemw - Node.js client.
 * mediawiki.api.js - A module that ships with MediaWiki core, abstracts many API calls into simple one liners (uses  internally).
 * jQuery.ajax - Not specifically made for the MediaWiki API, but most queries are very simple with one or two lines of using  or.
 * JsMwApi A convenience wrapper around raw requests, with some helpers for editing and parsing.
 * mwapilib - A kind of crappy layer overtop of the requests. Make JS gadgets easier.
 * Luasóg - A framework of standard requests (e.g. log in, log out, read, edit, etc.) as well as a general wrapper method. Includes some helpful stuff like throttling. Project includes a rudimentary IDE for off-site development and execution.

.NET

 * AutoWikiBrowser's WikiFunctions library has classes for editing and getting lists of pages via the API. See ApiEdit
 * WikiAccess - a C#-library that makes some API functions accessible, has write API.
 * DotNetWikiBot Framework - written in C#, based on Microsoft® .NET Framework 2.0 (Tutorial)
 * MorebitsDotNet contains C# code for uploading files through the API.
 * LinqToWiki, strongly typed library for accessing most of MediaWiki API, with support for autocompletion

OCaml

 * ocaml-mediawiki

Perl

 * MediaWiki::API - A Perl module for interfacing with the MediaWiki API with file upload/download and editing support. (Debian package)
 * MediaWiki::Bot - A higher-level Perl module with read and write functions. Easily extensible with plugins, for example to provide administrator functions.
 * Documentation Wikibook
 * Google Code project
 * Client scripts
 * Perl MediaWiki API - An open source Perl module wrapping many of the MediaWiki API functions.

PHP
There are many PHP frameworks for the api, see here for a full list and comparison of frameworks.
 * SxWiki - a lightweight, simple MediaWiki bot framework. (Unmaintained since 2008)
 * Apibot - a modular, somewhat ambitious bot with overlayed UNIX-like framework
 * wikibase-api-php - Specifically for querying Wikidata
 * wikidrain - A wrapper for the WikiMedia API centralized around easily and simply querying Wikipedia articles. (Still actively being developed)

Python

 * Pywikipediabot - A collection of python scripts. Seems up to date (Nov 2013) (IRC)
 * [//github.com/mwclient/mwclient mwclient] - A Python library that makes most of the API functions accessible. ([//pypi.python.org/pypi/mwclient/ PyPI])
 * wikitools - Provides several layers of abstraction around the API. Should be up to date ([//pypi.python.org/pypi/wikitools PyPI])
 * [//github.com/ianweller/python-simplemediawiki simplemediawiki] - A simple, no-abstraction interface to the API. Handles cookies and other extremely basic things. Python 2.6+ and 3.3+ compatible. ([//pypi.python.org/pypi/simplemediawiki PyPI])
 * [//github.com/legoktm/supersimplemediawiki supersimplemediawiki] - Very similar to simplemediawiki. ([//pypi.python.org/pypi/simplemediawiki PyPI])
 * [//github.com/yuvipanda/python-mwapi python-mwapi] - A simple wrapper around the Mediawiki API, meant to closely mirror its interface. Last update: Dec 2012 ([//pypi.python.org/pypi/python-mwapi PyPI])
 * Wikipedia -  A Python library that makes it easy to access and parse data from Wikipedia. (PyPI)

Ruby

 * wikipedia-client - Ruby framework using the API.
 * MediaWiki::Gateway - Ruby framework for the API. Maintained, tested up to MediaWiki 1.22, compatible with Wikimedia wikis.
 * RWikiBot - a Ruby framework using the API. No releases since 2008.
 * rbmediawiki - Another Ruby framework that uses the API. No releases since 2009.

Tcl

 * MediaWiki Tcl Bot Framework, includes IRC-RC Interface

Support Matrix
A support-matrix of many of the actively developed packages from this page for some of the more used API features can be found on the Wikia API Wiki.