On Tue, 25 Feb 2020, 19:04 Brad Jorsch (Anomie), <bjor...@wikimedia.org>
wrote:

> On Mon, Feb 24, 2020 at 6:01 PM Matthew Dowdell <mdowdell...@gmail.com>
> wrote:
>
>> This module takes POST requests, so I'd just send it as part of the
>> request body, but when it comes to deserialising it, I'm not really sure
>> what to deserialise it to as everything seems to assume primitive values,
>> e.g. strings, integers, etc. when it comes to setting the parameter type.
>>
>
> The Action API is generally based around a "form" model, and submission of
> complex data structures is generally discouraged. If you really need to do
> so anyway, you might accept data as a JSON string, or possibly you might
> use the "templated parameters" added in 1.32.
>
> MediaWiki now (since 1.34) also has a REST API. There the convention is to
> accept JSON data structures via POST or PUT, ideally validated against a
> JSON Schema of some sort.
>
>
> --
> Brad Jorsch (Anomie)
> Senior Software Engineer
> Wikimedia Foundation
> _______________________________________________
> Mediawiki-api mailing list
> Mediawiki-api@lists.wikimedia.org
> https://lists.wikimedia.org/mailman/listinfo/mediawiki-api


Thanks for the advice all. I think the REST API is the most promising
avenue of investigation and the interface I was hoping to discover, so
thanks to those who directed me towards it. The existing history
implementation looks particularly helpful as I've got something similar to
implement. For now I'll likely use the approach used by Wikibase with JSON
strings but aim to migrate over to coincide with the release of 1.35 (which
will be the next proper upgrade for my target wiki).

I haven't seen it mentioned in the docs so far, but is there support for
defining the interface using swagger/openapi? Given how tied into MediaWiki
the server will be it seems unlikely, but I figured it was worth asking in
case it was on a roadmap somewhere.

Cheers,
Matt
_______________________________________________
Mediawiki-api mailing list
Mediawiki-api@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-api

Reply via email to