Page MenuHomePhabricator

Review code snippets (PHP, Javascript & MediaWiki JS) around Action API for on-wiki documentation
Closed, ResolvedPublic

Description

As part of my GSoC project, I have developed sample code in PHP, Javascript, and MediaWiki JS to demonstrate the use of MediaWiki Action API modules. I want/seek review, valuable suggestions and feedback on the sample code format and accuracy :) I am sharing below one example each of a GET and POST request for a programming language. You can suggest your changes in a comment on this Phabricator task.

All these code samples will be shown in a tabbed window in all the API module pages on MediaWiki.org like in https://test.wikipedia.org/wiki/API:Sandbox via a Gadget that is a work in progress.

PHP

GET https://github.com/wikimedia/mediawiki-api-demos/blob/master/php/get_allpages.php
POST https://github.com/wikimedia/mediawiki-api-demos/blob/master/php/edit.php

Javascript

GET https://github.com/wikimedia/mediawiki-api-demos/blob/master/javascript/get_allpages.js
POST https://github.com/wikimedia/mediawiki-api-demos/blob/master/javascript/edit.js

MediaWiki JS

GET https://github.com/wikimedia/mediawiki-api-demos/blob/master/mediawikijs/get_allpages.js
POST https://github.com/Jayprakash-SE/mediawiki-api-demos/blob/mediawikijs-new/mediawikijs/edit.js

Event Timeline

Restricted Application added a project: User-Jayprakash12345. · View Herald TranscriptJul 19 2019, 9:14 PM
Restricted Application added a subscriber: Aklapper. · View Herald Transcript
srishakatux renamed this task from Sample review of mediawiki-api-demos to Review code snippets (PHP, Javascript & MediaWiki JS) around Action API for on-wiki documentation.Jul 19 2019, 10:01 PM
srishakatux updated the task description. (Show Details)
Anomie moved this task from Unsorted to Non-Code on the MediaWiki-API board.Jul 22 2019, 1:28 PM

From #wikimedia-cloud IRC
Oresrian: Jayprakash12345 for the PHP ones, you'll want to set a useragent as one of the curl options to properly identify your tool

Restricted Application added a project: Platform Engineering. · View Herald TranscriptJul 26 2019, 9:16 PM
Dzahn added a subscriber: Dzahn.Jul 30 2019, 2:00 AM

regarding the PHP ones. Maybe you want to add a README file with requirements / instructions what users need to install. For example i had to apt-get install php-cli php-curl to make get_allpages.php work.

Also i think it would be nice if you can get them linked from https://www.mediawiki.org/wiki/API:Tutorial somehow.

Jayprakash12345 closed this task as Resolved.Aug 25 2019, 12:06 AM
Jayprakash12345 claimed this task.