Cross-wiki API
Closed, DeclinedPublic

Description

It should be possible to e.g. query the French wiki through the English wiki API, like

en.wikipedia.org/w/api.php?interwiki=fr&action=query&...

This is needed for scripts using XHR, which can't go off-domain. An implementation should preferably add a table mapping interwiki prefixes to api.php URLs (maybe use the existing interwiki table for this?), then kind of forward the request by acting as a proxy (send an HTTP request to fr.wikipedia.org and spitting the output back out to the user). 302 and friends probably (?) won't work here (XHR's gotta be smarter than that).


Version: unspecified
Severity: enhancement

bzimport set Reference to bz14024.
Catrope created this task.Via LegacyMay 7 2008, 8:10 PM
brion added a comment.Via ConduitMay 7 2008, 8:26 PM

I'm a bit leery of this for several reasons:

  • authentication
  • private wikis
  • backend issues (are they hosted together, etc)
Catrope added a comment.Via ConduitMay 7 2008, 8:28 PM

(In reply to comment #1)

I'm a bit leery of this for several reasons:

  • authentication

Yeah, this could get nasty with passing cookies around and stuff like that.

  • private wikis
  • backend issues (are they hosted together, etc)

I see no problem there. The first wiki just forwards the request to the second wiki, and the second wiki's api.php decides what to output (whether the user has the needed rights, etc.)

DanielFriesen added a comment.Via ConduitMay 7 2008, 11:30 PM

I don't think one api.php should call another api.php.

This would probably be better handled with a column for storing an api url for an interwiki if that interwiki site is a MediaWiki site and does have an api.

And so the client could query the interwiki tables to know of any other API's that they can access. If there is one for the interwiki they queried for, then they can query from that API.

The Client shouldn't be using the API as a proxy, that's what we have JSON callback support for.

Catrope added a comment.Via ConduitAug 7 2008, 12:04 PM

Dunno why I made this depend on bug 14418, we need a schema change to the interwiki table here, not to the redirect table.

Catrope added a comment.Via ConduitAug 18 2008, 4:05 PM

To implement this, we'd need an iw_api field in the interwiki table containing the URL of the wiki's api.php

demon added a comment.Via ConduitAug 21 2008, 9:11 PM

Preliminary implementation. Needs a lot of work still (output needs formatting, so setReturnType() actually _does_ something). However, it does work :-)

demon added a comment.Via ConduitAug 21 2008, 9:12 PM

Created attachment 5206
Basic implementation

Ignore the previous comment *smack*.

Basic implementation works in this patch. Ran some basic test queries against enwiki and got the results I was expecting. Needs the cleanup I mentioned above.

Attached: newApi.patch

Catrope added a comment.Via ConduitSep 4 2008, 1:36 PM
  • Bug 15469 has been marked as a duplicate of this bug. ***
bzimport added a comment.Via ConduitSep 5 2008, 7:12 AM

Bryan.TongMinh wrote:

I don't really see a particular use for this. If you want ot bypass Javascript's same origin policy, you could as well use the document.write hack. Is there another use for this feature?

Suggest WONTFIX

bzimport added a comment.Via ConduitSep 5 2008, 7:18 PM

Bryan.TongMinh wrote:

(In reply to comment #10)

Supposedly it would help with
https://bugzilla.wikimedia.org/show_bug.cgi?id=15159

You don't have a same origin policy in PHP.

Catrope added a comment.Via ConduitSep 7 2008, 6:48 PM

(In reply to comment #11)

(In reply to comment #10)
> Supposedly it would help with
> https://bugzilla.wikimedia.org/show_bug.cgi?id=15159
>

You don't have a same origin policy in PHP.

No, but you still need to map interwiki prefixes to api.php URLs.

DanielFriesen added a comment.Via ConduitSep 7 2008, 8:46 PM

Allowing MediaWiki to access the api of something from an interwiki prefix is a different bug. This bug is about letting non-mediawiki things use the local API to access the API of another wiki through interwiki.

Catrope added a comment.Via ConduitSep 7 2008, 8:54 PM

(In reply to comment #13)

Allowing MediaWiki to access the api of something from an interwiki prefix is a
different bug. This bug is about letting non-mediawiki things use the local API
to access the API of another wiki through interwiki.

Yeah, maybe we should split this bug into:

  • creating a table that maps fr: -> http://fr.wikipedia.org/w/api.php and making that table retrievable through the API
  • allowing proxying through the API using the aforementioned feature
bzimport added a comment.Via ConduitSep 7 2008, 8:57 PM

mike.lifeguard+bugs wrote:

see bug 15469 too - a possible duplicate?

Catrope added a comment.Via ConduitSep 7 2008, 9:30 PM

(In reply to comment #15)

see bug 15469 too - a possible duplicate?

I marked that one as a dupe yesterday or the day before.

Catrope added a comment.Via ConduitMar 30 2009, 5:17 PM
  • Bug 2463 has been marked as a duplicate of this bug. ***
bzimport added a comment.Via ConduitJul 12 2009, 8:22 PM

Bryan.TongMinh wrote:

(In reply to comment #14)

(In reply to comment #13)
> Allowing MediaWiki to access the api of something from an interwiki prefix is a
> different bug. This bug is about letting non-mediawiki things use the local API
> to access the API of another wiki through interwiki.
>

Yeah, maybe we should split this bug into:

  • creating a table that maps fr: -> http://fr.wikipedia.org/w/api.php and making that table retrievable through the API
  • allowing proxying through the API using the aforementioned feature

This bug clearly concentrates on the second point. I still see no reason for this feature, so I'm closing this as WONTFIX.

Mr.Z-man added a comment.Via ConduitJul 12 2009, 11:12 PM

Is there an open bug for the other point?

Add Comment