Extension:PageLanguageApi/API

From MediaWiki.org
Jump to navigation Jump to search

Token[edit]

To change the page language for a page, an edit token is required via action=query&meta=tokens .

Changing page language[edit]

The language for a page can be changed using action=pagelang.

Parameters[edit]

  • titles: A list of titles
  • pageids: A list of page ids
  • lang: The target language for the page(s), if not set taken as default wiki language.
  • token: The token obtained in the previous request. Take care to urlencode the + as %2B.

Don't forget to append = even to parameters with no value, for example &lang doesn't work, &lang= does work

Example[edit]

Note Note: In this example, all parameters are passed in a GET request just for the sake of simplicity. However, action=pagelang requires POST requests; GET requests will cause an error.


Changing page language for Project:Sandbox & Main Page

Possible errors[edit]

In addition to the usual stuff:

Code Info
notoken The token parameter must be set
badlanguage-code The language code is not valid
permissiondenied Permission denied