Following the “Guidelines” by codecademy

Early February I completed the major parts of my project i.e Querying and Parsing Wikipedia through mediawiki API with help of my mentor Yuri Astrakhan. Total Exercises Completed are 44.Though the last part i.e Editing is stuck due to security issues.

It was another day when I was trying to ask for help from codecademy on the editing Wikipedia pages through api call from their website. Instead I got a different response from them saying “Our courses are designed for beginners. Our users only go through 20 to 30 exercises at the most – e.g., our entire JavaScript is 28 courses while our jQuery track is 14 courses. Currently, your wikimedia course is 44 exercises which is almost double to triple the exercises we offer.  Also, we don’t generally support authenticated apis ” .

The response was a feedback itself for us straight from codecademy. So we planned to mend our course in a way they have suggested. And for that we planned the following:

  • Split our course into two courses.
  • Segregate them on the basis of Basic concepts and Advanced concepts of Wikipedia API.
  • Finally title them as  ” Introduction to Wikipedia API ” and ” Wikipedia: Query API “.

Started working on the same and divided the courses in the following way :

  • Introduction to Wikipedia API have 2 sections:
    • Parsing Wiki: which includes all the exercises related to action=parse.
    • Querying Wiki: which includes very basic exercises related to action=query like text search, continuing queries, revisions, etc.
  • Wikipedia: Query API have 3 sections:
    • Query-Lists: which includes the exercises that get lists of pages that match certain criteria.
    • Query-Prop: which includes the exercises that get different properties of pages.
    • Query-Meta: which includes the exercises that get meta information about the wiki and the logged-in user.

Completed both the courses with 17 exercises in Introductory course and 24 exercises in other. And also both the courses are submitted for review.

Currently we are postponing the editing part until and unless we have a proper and easy way to demo it in our course.

Meanwhile I’ll be editing some wiki pages related to mediawiki API with my newly learnt stuff.

Annoyed by the first concern:Security

First time in my life I am annoyed with my first preference and concern which has always been “Security”. After completing parse and query aspects of the api in codecademy I took a step towards the modifying aspect of mediawiki api.

Modification includes:

  • Creation of a user account.
  • Editing pages.
  • Adding pages to their watchlist.
  • But not deleting as most of the users are not admins.

To modify or edit a Wikipedia page, we need to issue the two following requests:

  1.  To get the action token.
  2.  To use the above token to change some page say Wikipedia:Sandbox .

I started with getting an edit token through api call by passing following json request variable                                                                                                                                 var req = {
format: ‘json’,
action: ‘query’,
prop:’info’,
intoken:’edit’,
titles:’Wikipedia:Sandbox’
};                                                                                                                                            using ajax , But I got the same warning repetitively saying,

"warnings": {
    "info": {
      "*": "Unrecognized value for parameter 'intoken': edit"
    }

I couldn’t understand the problem so i had a talk with my mentor Yuri Astrakhan and he told me its because of “callback” parameter that we use to get the data.He said it was most likely added to prevent what i am trying to do i.e  to prevent calling mediawiki api from non wiki website(in my case codecademy) as an anonymous user to edit/modify Wikipedia pages. As the above warning was unclear I filed a bug on Bugzilla.

As suggested by Yuri, the best way to solve this issue was to join the mediawiki api mailing list and send them a mail stating the current situation, so I did the same. And I got the reply from Chris Steipp suggesting “to use OAuth but if we are using WMF wiki like mediawiki.org instead of mediawiki instance then the cross-origin issues are going to make it very difficult in general, and the only way will likely be to have your javascript talk to codeacademy, and have codecademy use OAuth to access the wiki on behalf of the user. If it’s the former, then you can setup CORS between the domains, and use the api to login, and all calls with be authenticated due to the user’s session.” . It was doubtful whether we could do CORS for codecademy as there is a probability of a huge security hole.

Ahhhhhhh…. I was so ANNOYED :@ by the whole security issue and started exploring OAuth which I could understand conceptually but not its implementations.

Finally we came to one conclusion to quickly setup a simple instance on mediawiki and setup CORS on that which I am going to work on this week  with my mentor. :D

Exploring Query API and Implementing Generators

Started my year with exploring query aspects of mediawiki API. Got to learn many things about Lists , Props and Meta. This was the huge module as it contains hundreds of sub-module which functions as a wrapper on top of SQL access to the internal databases. Really enjoyed making the live tutorials on all the aspects of getting data  :) Concepts like getting data just the users need, multiple pages, continuing queries,meta information, generators and many things are covered in my tutorial. Have a look and try some!!! .

Listing covers many facets like:

  • Performing full text search
  • Listing Wikipedia categories
  • Getting information of a Wikipedia user(s)
  • What links here functionality
  • Listing images
  • Listing pages that use a given image
  • Continuing queries
  • Geo search
  • Generators

Props covers facets like:

  • Getting multiple information in one request
  • Getting content of the revision of a page using prop=revisions
  • Getting revisions made by anonymous user
  • Accessing image information
  • Accessing page information

Meta covers:

  • Interface message information
  • Wiki information
  • User information

The above lists cover all the basic functionality although there are a lot more in the tutorial.

While exploring query API , I came to know about “Generators” , what are they?, what they do? and why we use them?

I implemented this concept in listing which shows the information about the Geo-coordinates of the Wikipedia articles.

First step in Wikimedia through Codecademy

Started working for Wikimedia as an intern with a feeling of determination.It has only been 3 weeks and i have learned a lot in this duration and Now I have started wondering how much I’ll be learning in these 3 months. And the best part of this project is that I get to Teach others, whatever i have learnt,  by creating online tutorials of mediawiki API development course on codecademy.

Week 1( 10 Dec- 16 Dec):

  • Started the project by discussing with my mentor Yuri Astrakhan about which modules of mediawiki API should be implemented and those are Parsing, Querying and Modifying.
  • Began with Parsing with the reference of API:Parsing_wikitext and Mediawiki API Documentation . Also tried API:Sandbox to get an idea about actual output.
  • Got so much confused between title and text parameter of action=parse. And the confusion got resolved through IRC. :)
  • After so many reviews of mentor and the changes I finally created a tutorial for Getting wikimarkup text as an HTML .
  • And once I got the whole idea about how a tutorial must be implemented and how it should look like(HTML/CSS) , I started with other action=parse tutorials.

This week was all about learning and trial & error:

  • My mentor’s review taught me so many things which I had no idea about like Two key Principles KISS(Keep It Simple Stupid) and DRY(Don’t Repeat Yourself). :D
  • Then he told me how to always imply these principles in your code specially while writing a code for client side.

Week 2 (Dec 17- Dec 23):

Week 3 (Dec 23- Dec 30)

As the time flies this project is getting more and more interesting for me. Learning something new everyday is helping me know how to impart my knowledge to others who want to know about mediawiki APIs.

Congratulations!!!”On Your OPW Acceptance”

“The best Gift” this year gave me was an e-mail saying “Congratulations!!! On your OPW acceptance”. I have been selected as an intern for OPW (Outreach Program for Women) 2013. Even today I go back to the mail to read it again which brings an amazing smile on my face. After Mozilla, Wikimedia has given me a chance to show my enthusiasm towards contributing to FOSS communities. I am grateful to Priyanka Nag and Netha Hussain who introduced me to this program through Womoz(Women in Mozilla). Also I am thankful to gnome and Wikimedia for selecting my project proposal. I got a new experience of writing a proposal which included: conversations with the mentors, making small contribution to the project, guidance for writing a project proposal and all these helped me to move one step ahead. This experience is stored in my personal Knowledge Repository! And there is a lot to come. I believe in “Learning by Teaching” and luckily got the project related to it.

My project is about creating online tutorials of media wiki API for developers and students.I really appreciate Yuri Astrakhan for mentoring me throughout the whole process of making a contribution to the project. Have a look at it http://www.codecademy.com/courses/web-beginner-en-o94o8/0/1 . I am waiting to get started with the project that will be from 10th December 2013. I am really excited about it and I hope that I mark up to the expectations of the program and Wikimedia.