By the way, Yuri's suggestion did work. I don't know if you use to post code in this list for the archive, so i will be succint: let's say I subclassed ApiFormatBase and overwrote execute like this
public function execute() { $data = $this->getResultData(); $this->printText($data[0]); }
so it strips the array from the response just gettings it's first value.
Then, in the extension code, getCustomePrinter is also overriden like this
public function getCustomPrinter() { return new MyApiFormat($this->getMain(),'plain'); }
& that's all folks.
Not too pretty, since the return array can be set only once, but it's enough for my needs and I think it can be easily worked on.
So this is my give back.
On 28.12.2012 17:34, webmaster@numerica.cl wrote:
Great, that method had called my attention indeed. Let's see what it can do... Thanks for the pointer.
¡Felices fiestas!
On 28.12.2012 17:29, Yuri Astrakhan wrote:
what i think you need is to create a custom printer for your action. I remember some api modules do that for various reasons. See getCustomPrinter
On Fri, Dec 28, 2012 at 3:26 PM, wrote:
On 28.12.2012 17 [1]:13, Yuri Astrakhan wrote:
What do you mean by return from an api extension? Are you saying you want to custom-format the resulting API output? non-json, etc?
hi Yuri, thanks for the quick reply. Exactly, I would need it to return just plain text/html for an other program to interpret it, so having it inside an array is problematic. Sounds too difficult?
Mediawiki-api mailing list Mediawiki-api@lists.wikimedia.org [2] https://lists.wikimedia.org/mailman/listinfo/mediawiki-api [3]
Links:
[1] http://mail.numerica.cl/tel:28.12.2012%2017 [2] mailto:Mediawiki-api@lists.wikimedia.org [3] https://lists.wikimedia.org/mailman/listinfo/mediawiki-api [4] mailto:webmaster@numerica.cl
Mediawiki-api mailing list Mediawiki-api@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-api