Page MenuHomePhabricator

Client Developer uses MediaWiki REST API
Closed, ResolvedPublic

Description

"As a Client Developer, I want to have a RESTful CMS-level API available for each project and language, so I can provide CMS-style functionality to my end user."

For the Core REST API, we’ll use paths that look like:

/core/v<version>/<project>/<language>/<path> (If the project has multiple languages)
/core/v<version>/<project>/<path> (If the project has just one language)

There may be cases in which we will have incompatible versions of the Core REST API running on different projects. For example, if/when a version 2.x of the Core REST API is released, which isn’t backwards-compatible with version 1.x, it may roll out to Group 0, Group 1, Group 2, etc. on different schedules.

PathMapping
/core/v1/wikipedia/<language>/<path><language>.wikipedia.org/w/rest.php/v1/<path>
/core/v1//wiktionary/<language>/<path><language>.wiktionary.org/w/rest.php/v1/<path>
/core/v1/commons/<path>commons.wikimedia.org/w/rest.php/v1/<path>
/core/v1/wikibooks/<language>/<path><language>.wikibooks.org/w/rest.php/v1/<path>
/core/v1/wikiquote/<language>/<path><language>.wikiquote.org/w/rest.php/v1/<path>
/core/v1/wikiversity/<language>/<path><language>.wikiversity.org/w/rest.php/v1/<path>
/core/v1/mediawiki/<path>mediawiki.org/w/rest.php/v1/<path>
/core/v1/wikidata/<path>wikidata.org/w/rest.php/v1/<path>
/core/v1/wikisource/<language>/<path><language>.wikisource.org/w/rest.php/v1/<path>
/core/v1/wikivoyage/<language>/<path><language>.wikivoyage.org/w/rest.php/v1/<path>
/core/v1/meta/<path>meta.wikimedia.org/w/rest.php/v1/<path>
/core/v1/wikinews/<language>/<path><language>.wikinews.org/w/rest.php/v1/<path>
/core/v1/wikispecies/<path>species.wikimedia.org/w/rest.php/v1/<path>

Event Timeline

eprodromou updated the task description. (Show Details)Oct 11 2019, 3:43 PM
eprodromou reassigned this task from eprodromou to hnowlan.Jun 19 2020, 4:10 PM
eprodromou triaged this task as High priority.
eprodromou updated the task description. (Show Details)

@hnowlan I think we probably have internal routes to the mediawiki servers that would be more reasonable to use than the public ones. I don't know what those are; maybe you can figure it out?

eprodromou updated the task description. (Show Details)Jun 19 2020, 4:11 PM
hnowlan added subscribers: Clarakosi, Pchelolo.EditedJul 7 2020, 1:18 PM

Myself, @Clarakosi and @Pchelolo discussed this a bit and also consulted with serviceops. It would be easier for some value of easy to pass this routing off to the appservers given their existing knowledge of routing and ease of parsing, but we decided that it would be counter to the spirit of the gateway to move this logic out of the gateway. There is a first pass of this routing logic in https://gerrit.wikimedia.org/r/c/operations/deployment-charts/+/609808. Configuration can be seen in https://gerrit.wikimedia.org/r/c/operations/deployment-charts/+/609808/3/charts/api-gateway/values-devel.yaml

In the future we will evaluate using the xDS configuration plane to offload this routing logic once it is built, as Envoy's model recommends moving routing configuration in this manner and not maintaining it as configuration. For the time being the above approach will suffice, give or take some iteration

Naike reassigned this task from hnowlan to eprodromou.Aug 7 2020, 12:00 PM
Naike added a subscriber: hnowlan.

This routing can be tested on https://api.wikimedia.org.

I'm getting most of the wiki projects working correctly, but some don't. Here's the list of URLs that don't work:

I haven't checked all languages; I'll dig into them when these are fixed.

Also, I'm really surprised to see 404 errors in HTML here. It seems like the default for a failed route is to pass through to the API Portal. That's really the wrong behaviour. I've added a new ticket T260795 to track that.

Change 621581 had a related patch set uploaded (by Ppchelko; owner: Ppchelko):
[operations/deployment-charts@master] Properly set x-internal-host for domains with no lang

https://gerrit.wikimedia.org/r/621581

Change 621581 merged by jenkins-bot:
[operations/deployment-charts@master] Properly set x-internal-host for domains with no lang

https://gerrit.wikimedia.org/r/621581

Change 621585 had a related patch set uploaded (by Ppchelko; owner: Ppchelko):
[operations/deployment-charts@master] Api-gateway: fix pathing map

https://gerrit.wikimedia.org/r/621585

Change 621585 merged by jenkins-bot:
[operations/deployment-charts@master] Api-gateway: fix pathing map

https://gerrit.wikimedia.org/r/621585

Ok. Now they all work.

eprodromou closed this task as Resolved.Sep 16 2020, 2:58 PM