Page MenuHomePhabricator

Develop code samples in Javascript and PHP to demonstrate the use of MediaWiki Action API modules
Open, Needs TriagePublic

Description

Background

The 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 ~128 pages on the Action API on MediaWiki.org. Developer-Advocacy did a little 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 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: Investigate and improve MediaWiki Action API documentation
    • Write a code generator (output files in Javascript or PHP) for modules supporting GET requests like 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, 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

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

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptFeb 9 2019, 1:06 AM
srishakatux updated the task description. (Show Details)Feb 9 2019, 1:09 AM
srishakatux updated the task description. (Show Details)Feb 10 2019, 6:46 AM
Anomie moved this task from Unsorted to Non-Code on the MediaWiki-API board.Feb 11 2019, 4:38 PM

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.

I have one more suggestion to add MediaWiki Javascript techniques for API.

Api = new mw.Api();

PARAM = {
     // Define parameters here
}

// Get Request
Api.get( PARAM ).done( function (obj)  {     ....    } );

// Post Request with Token
Api.postWithToken( 'csrf',  PARAM ).done( function (obj)  {     ....    } );

This will help a lot to MediaWiki Extensions Developer and persons who are working on Gadgets and UserScripts on Wikipedia and its sister project. Thanks :)

srishakatux updated the task description. (Show Details)Feb 15 2019, 6:14 PM
Bahl24 added a subscriber: Bahl24.Feb 24 2019, 8:41 PM
srishakatux updated the task description. (Show Details)Feb 26 2019, 2:40 AM

@srishakatux I would like to work on this project in GSoC .
Actually, I looked into microtask 2 and would like to work on it.
I would like to know if there should be a different modules.json for javascript as in current modules,json the filename parameter, which is used to name the generated files, has .py extension in all the instances or it should to be taken care explicitly when generating the js files.

@Shivanshbindal9 Thanks for your interest in working on this project! Please see Step 4 under https://www.mediawiki.org/wiki/Google_Summer_of_Code/Participants#Application_process_steps and read the note about asking specific questions!

There are quite a lot of microtasks available for this project (see task description). You can start from there :)

Sorry, for any inconvenience.
Actually, I looked into microtask 2 and would like to work on it.
I would like to know if there should be a different modules.json for javascript as in current modules,json the filename parameter, which is used to name the generated files, has .py extension in all the instances or it should to be taken care explicitly when generating the js files.

I am interested in this task for GSoC.

Abhism9450 updated the task description. (Show Details)Feb 27 2019, 10:13 AM

@srishakatux @srodlund What is the exact mean of Javascript here? Is it about Ajax Javascript (XMLHttpRequest) or Node.js?

@srishakatux I have tried to expand autogenerator.py to output javascript files. Here is the link to PR (https://github.com/wikimedia/MediaWiki-Action-API-Code-Samples/pull/65). Can you please look review it. Thanks. :)

@srishakatux I have added purge_two_pages and purge_namespace_pages API in Javascript. I made a pull request in Github.
Please review it. Thanks

srishakatux added a comment.EditedFeb 27 2019, 11:38 PM

Sorry, for any inconvenience.
Actually, I looked into microtask 2 and would like to work on it.
I would like to know if there should be a different modules.json for javascript as in current modules,json the filename parameter, which is used to name the generated files, has .py extension in all the instances or it should to be taken care explicitly when generating the js files.

@Shivanshbindal9 That is a very great point you've shared. I realize that the filenames in modules.json should be without any extension and determined in the autogenerator.py. Do you want to maybe file an issue around this? Feel free to assign it to yourself if you would like to work on it.

@srishakatux I have tried to expand autogenerator.py to output javascript files. Here is the link to PR (https://github.com/wikimedia/MediaWiki-Action-API-Code-Samples/pull/65). Can you please look review it. Thanks. :)

Sweet! I will take a look at in 2-3 days.

@srishakatux @srodlund What is the exact mean of Javascript here? Is it about Ajax Javascript (XMLHttpRequest) or Node.js?

Good question! It is about AJAX javascript :)

@Abhism9450 Thanks for making a pull request! I will review within 2-3 days.

srishakatux updated the task description. (Show Details)Feb 28 2019, 1:52 AM
Nikitrain updated the task description. (Show Details)Feb 28 2019, 8:26 AM
Nikitrain updated the task description. (Show Details)Feb 28 2019, 8:59 AM
Nikitrain updated the task description. (Show Details)Feb 28 2019, 9:02 AM
Nikitrain updated the task description. (Show Details)
Nikitrain updated the task description. (Show Details)Feb 28 2019, 9:15 AM
Nikitrain removed a subscriber: Nikitrain.

Hi, @srishakatux I would like to contribute to this project in GSoC.

Wisdomanthoni updated the task description. (Show Details)Mar 1 2019, 8:50 PM
Wisdomanthoni updated the task description. (Show Details)
notnotparas removed a subscriber: notnotparas.
notnotparas updated the task description. (Show Details)Mar 2 2019, 4:18 AM
Sumanth699 updated the task description. (Show Details)Mar 2 2019, 4:51 AM

Hi @srishakatux, I would like to work on this project.
I looked at microtask 3 and would like to work on it.

Adarshpatel509 updated the task description. (Show Details)
Urvaxhi added a subscriber: Urvaxhi.Mar 4 2019, 9:05 AM

I have worked on converting selected files to their javascript equivalent ... Pull Request can be reviewed via this link https://github.com/wikimedia/MediaWiki-Action-API-Code-Samples/pull/92

If you've finished working on a microtask and awaiting review or you are looking for more microtasks, but you don't see any available, you can continue to learn more about Wikimedia projects: https://www.mediawiki.org/wiki/New_Developers. I think that contributing code to fix small bugs might be a good place to start: https://www.mediawiki.org/wiki/Good_first_bugs. If your patch for a bug fix ends up getting accepted, you can mention about it as well in your GSoC application :)

i wanted to ask in microtask 3 we have to do all the subtasks?

@Sakshi0610 Thanks for your interest! At this point, this project has received a lot of interest and contributions from
potential candidates already. I will encourage you to take a look at other projects we are promoting in Google-Summer-of-Code (2019) https://www.mediawiki.org/wiki/Google_Summer_of_Code/2019.

Folks interested in applying for this project, I encourage you to finish writing your proposal in Phabricator by Friday (April 5th). Ping me on Zulip when you're done so that I can review your application and give you some feedback that you can incorporate before the deadline.

This comment was removed by Sumanth699.

I am selected for this project, for smooth task management added personal phabricator project. Thanks a lot @srishakatux Ji !