Page MenuHomePhabricator

RESTBase /v1/related endpoint should call the MW action API with a GET not a POST
Closed, ResolvedPublic

Description

In https://gerrit.wikimedia.org/g/mediawiki/services/restbase/+/c8915660aa2025d1695db797088b932b4c1d6215/v1/related.js#60 it appears that REST base is making a POST request to the MW Action API.
There are no apparent reasons to use a POST here and I believe that a GET should be preferred.

The morelike CirrusSearch keyword is very costly and the use of the POST verb seems to force the request to happen on the MW appservers running in the master DC. This has several drawbacks:

Event Timeline

MSantos triaged this task as Medium priority.Sep 21 2023, 2:08 PM
MSantos edited projects, added Essential-Work; removed Content-Transform-Team.

I made a pull request: https://github.com/wikimedia/restbase/pull/1336

Could it be that simple? I haven't tested it yet.

It looks like the core MW ApiQuerySearch module does not require POST and the HTTP body parameter in the linked code don't seem like they would be too long, even 'gsrsearch' which is basically a just title AFAIK. So, this looks like it's a matter of changing the restbase call to GET and moving the body parameters to URL parameters. The larger work probably lies in setting up and testing restbase.

There is a question of maintainership. Who owns this restbase component, or at least the restbase platform? Or, at least, is most familiar with the code. Would it be the people working on restbase deprecation? CC'ing @daniel, @DAlangi_WMF , @MSantos @Jgiannelos.

According to Turnilo, the endpoint is used mostly by the Wikipedia app, and I suspect that it was built for that purpose. Maybe that means the Apps team owns it?

By the way, this is one of the endpoints we need to move out of RESTbase. It should be replaced by a REST Handler in MediaWiki (core or extension). We should start a discussion on who should work on that, and when.

By the way, this is one of the endpoints we need to move out of RESTbase. It should be replaced by a REST Handler in MediaWiki (core or extension). We should start a discussion on who should work on that, and when.

The RelatedArticle MW extension could perhaps be a good fit? It provides the UI for the mobile web frontend for this similar feature and is making a similar request to the search API via the action API.

The RelatedArticle MW extension could perhaps be a good fit? It provides the UI for the mobile web frontend for this similar feature and is making a similar request to the search API via the action API.

Perhaps. On the other hand, since CirrusSearch exposes this functionality via the action API, it would make sense if it also offered the same functionality through a REST API. I filed T351040 for tracking this.

Jgiannelos claimed this task.