After finishing with the implementation of update and insert, I decided to work on implementing the renaming pages functionality. I also tried quite a few MediaWiki modules to display the success and error messages for the spreadsheet.

Renaming pages using MediaWiki Move API

The Move API can be used to rename a page with the help of a csrf token. The token can be obtained using the Query API:

  • js
    function getToken() {
    	var url = baseUrl + '/api.php?action=query&format=json&meta=tokens&type=csrf';
    	return $.post( url );
The token returned then can be used to rename a particular page. The query used is:
baseUrl + '/api.php?action=move&format=json&' + 'from=' + encodeURIComponent( fromPage ) + "&to=" + encodeURIComponent( toPage ) + "&movetalk&noredirect";
where the page fromPage is renamed to toPage and the talk page is also moved, leaving no redirect.

Success and error messages

I have used the mw.notify() module to display success and error messages as popups on the screen and they hide automatically after some time. I have also added a parameter type: ‘error’ to add formatting to the error messages. For example:

Error in renaming a page Error in renaming a page

Patch(es) on Gerrit: