[Labs-l] Using data from a tool in a Wikimedia site

Rainer Rillke rainerrillke at hotmail.com
Sat Nov 29 15:15:25 UTC 2014


Hi Darkdadaah,

> I'd like to know if it is possible to use data from a tool in a
> Wikimedia site?

Sure.

> I created a search tool

Nice! Do you think other wiktionaries could benefit from that as well?

> This would only require the use of a dedicated Gadget on the site.

Well, actually a script only. Gadget would be great.

> So: is it possible to do this (via e.g. CORS)

Exactly. Use CORS and relative URIs and it should be very secure, unless
your client side application has other flaws.

If you are looking for a sample application, have a look at FileAnalyzer:

* In action:
https://commons.wikimedia.org/w/index.php?title=Commons:User_scripts/File_Analyzer&withJS=MediaWiki:FileAnalyzer.js
* Client side script:
https://commons.wikimedia.org/w/index.php?title=MediaWiki:FileAnalyzer.js
* Labs API entry point: https://tools.wmflabs.org/expose-data/jsonapi.php
* Source code (server side): https://github.com/Rillke/expose-data
** The most interesting file for you might be
https://github.com/Rillke/expose-data/blob/master/jsonapi.php
** To see the full source code (shared directory) go to
/data/projects/rillke/public_html/shared/ on labs and there have a look
inside the common.php
The matchOrigin() just verifies it's a WMF site that makes users access
this resource.

Kind regards and good luck building your pronunciation search tool!
-- Rillke



More information about the Labs-l mailing list