A partial archive of https://discourse-mediawiki.wmflabs.org as of Saturday May 21, 2022.

Specialpage use API

y-s-d

I am working on an extension with provides an API to get some information and use them in an application.
To provide the same information to users of the website version I want to show them on a special page.

Is it possible to use the API from the special page so that the query only needs to be maintained at one point?

LucasWerkmeisterWMDE

Instead of directly accessing the API from the special page, it would probably be better to extract all the logic into a separate class (or several), and make the API and the special page classes both wrappers around that class. There shouldn’t be a lot of special logic in the API or special page classes beyond input parsing and validation, and output formatting.

Tgr

Possible but strongly discouraged. See T93897 and RfC: Business Layer Architecture on budget for some related discussion.

As Lucas says, separate logic from presentation instead.