Hi Mathew,
With java api I generated the json object, and edit item with a python script. Yo can do
the same procedure with the many available apis in java, python, js.
Regards
Luis
Matthew Dowdell <mdowdell244(a)gmail.com> hat am
25. Februar 2020 um 00:00 geschrieben:
Hi All,
I'm writing an API module that I'd like to take 'complex' data for
one of the parameters, e.g.
{
"action": "example",
"token": "<some csrf token>",
"data": [
{"key": "value1", "otherkey":
"othervalue1"},
{"key": "value2", "otherkey":
"othervalue2", "optionalkey": "optionalvalue"},
{"key": "value3", "otherkey":
"othervalue3"}
]
}
The list in data can grow to several hundred elements all of which contain the same 2
keys with an optional third. For reference, I'm developing on mw1.31, but I can swap
to something more recent if that's where new possibilities become available.
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. I'm not averse to claiming it's a string and
deserialising it myself, but my attempts so far haven't proved successful. I also
tried writing a phpunit test which displayed different behaviour (it seems to have quietly
lost the value) and using the mwapi python library for an integration/end-to-end test
which caused a third behaviour by quietly joining the elements in the list into a string.
I get the feeling what I'm trying to do is at the very least non-standard for
mediawiki.
Does anyone have experience in trying to do this or know of prior art that does
something similar?
Cheers,
Matt
_______________________________________________
Mediawiki-api mailing list
Mediawiki-api(a)lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-api
Luis Ramos
Senior Java Developer
(Semantic Web Developer)
PST.AG
Jena, Germany.