====Background====
The [[ https://www.mediawiki.org/wiki/API:Main_page | MediaWiki action API ]] is a web service that allows access to some wiki-features like authentication, page operations, and search. It can provide meta information about the wiki and the logged-in user. Several Wikimedia projects make use of this API.
As of now, there are [[ https://www.mediawiki.org/wiki/Category:MediaWiki_action_API | ~128 pages ]] on the Action API on MediaWiki.org. #developer-advocacy did a little [[ https://www.mediawiki.org/wiki/User:SSethi_(WMF)/Sandbox/Research_on_the_state_of_the_docs_of_mw_action_api | research on the state of the docs ]] and documented a few problems and recommendations for the next steps. One of the issues we decided to address was inconsistency. For example, some pages had the automated API docs embedded; some didn’t, some pages had code samples, some didn’t, etc. As a first step, we designed a [[ https://www.mediawiki.org/wiki/API:Documentation_template | documentation template ]] and used it to re-write top 20 viewed pages of the API. But, we realized we could not improve 128 pages all by ourselves, and opened it to new Wikimedia contributors for help :-) Our Outreachy intern @Martyav put in a lot of good work in this and improved the next ~20 viewed pages and brought this project in good shape!
While in this process our team led a survey about the current technical documentation for action API to understand in which areas should we invest our energy more! What is working well, and what could be improved (link TBA). Fifty participants filled out the survey. One of the requests we received in the survey from contributors is to provide sample code in at least two or more programming languages, preferably PHP and Javascript.
==== Project summary====
This project will be about developing sample code in two or more programming languages (e.g., Javascript and PHP) to demonstrate the use of MediaWiki Action API modules. Here is what this will entail:
* Design and embed a tabbed window on the API pages (like on the right here https://www.twilio.com/docs/usage/api), possibly via a template or Gadget.
* Generate code samples for modules that received documentation improvements in Phase 1 and Phase 2: {T198916}
** Write a code generator (output files in Javascript or PHP) for modules supporting GET requests like [[ https://github.com/srish/MediaWiki-Action-API-Code-Samples/blob/master/python/autogenerator.py | here ]].
** Write sample code for API modules for which code generator might not work.
* Document the code samples on-wiki
* (OPTIONAL) Develop one or two demo apps around the use of Action APIs
====Skills required====
Wiki editing, Templates, creating and managing translatable pages, [[ https://phabricator.wikimedia.org/ | Wikimedia Phabricator ]] tool, basic Python, PHP and/or Javascript programming. Note: some or all of these skills would be nice to have but not required. Come with a desire to learn and that be all!
==== Code repository====
https://github.com/wikimedia/MediaWiki-Action-API-Code-Samples
==== Microtasks====
[] A one-page proposal for a demo app (~100 lines code in Javascript, Python or PHP) around the use of MediaWiki Action API. In the proposal, share what the app will do, which modules it will use, what will be your approach and how you would implement it. Add some visuals to explain the flow of the app. Share this in a Google Doc with @srishakatux on Zulip. The final version of this proposal will go into your GSoC proposal. You can check some ideas in progress for reference: T212006.
[] Expand the [[ https://github.com/wikimedia/MediaWiki-Action-API-Code-Samples/blob/master/python/autogenerator.py | autogenerator.py ]] to output Javascript files. |@Shivanshbindal9 |
[] Write Javascript equivalent for following code samples:
[] [[ https://github.com/wikimedia/MediaWiki-Action-API-Code-Samples/blob/master/python/delete.py | delete.py ]] |@notnotparas|
[] [[ https://github.com/wikimedia/MediaWiki-Action-API-Code-Samples/blob/master/python/edit.py | edit.py ]] |@Wisdomanthoni |
[] [[ https://github.com/wikimedia/MediaWiki-Action-API-Code-Samples/blob/master/python/get_my_watchlist_feed.py | get_my_watchlist_feed.py ]] |@Wisdomanthoni |
[] [[ https://github.com/wikimedia/MediaWiki-Action-API-Code-Samples/blob/master/python/login.py | login.py ]] |@Sumanth699|
[] [[ https://github.com/wikimedia/MediaWiki-Action-API-Code-Samples/blob/master/python/move.py | move.py ]] |@notnotparas|
[] [[ https://github.com/wikimedia/MediaWiki-Action-API-Code-Samples/blob/master/python/parse_wikitable.py | parse_wikitable.py ]] |@Adarshpatel509 |
[] [[ https://github.com/wikimedia/MediaWiki-Action-API-Code-Samples/blob/master/python/purge_namespace_pages.py | purge_namespace_pages.py ]] |@Abhism9450 |
[] [[ https://github.com/wikimedia/MediaWiki-Action-API-Code-Samples/blob/master/python/purge_two_pages.py | purge_two_pages.py ]] |@Abhism9450 |
[] [[ https://github.com/wikimedia/MediaWiki-Action-API-Code-Samples/blob/master/python/userrights.py | userrights.py ]] |
@Adarshpatel509 |
[] [[ https://github.com/wikimedia/MediaWiki-Action-API-Code-Samples/blob/master/python/watch.py | watch.py ]]|@Sumanth699|
Instructions: Anyone can work on Task 1. Only one person gets to work on Task 2 or 3 at a time. Before working on any of the items in Task 2 and 3, put your username next to it, so that others are aware. Contribute sample code to the repository: https://github.com/wikimedia/MediaWiki-Action-API-Code-Samples.
====Mentor(s)====
@Srishakatux @srodlund
==== Get in touch with mentors====
Ask a question in the topic `Phab:T215681 Develop code samples for API modules in JS/PHP` under https://wikimedia.zulipchat.com/#narrow/stream/180873-gsoc19-outreachy18
==== Resources ====
* How to use or write Templates https://www.mediawiki.org/wiki/Help:Templates
* Page translation https://www.mediawiki.org/wiki/Help:Extension:Translate/Page_translation_example
* Editing wiki pages https://www.mediawiki.org/wiki/Help:Editing
* Learn how to use Phabricator https://www.mediawiki.org/wiki/Phabricator/Help