Hi
Im having trouble to get MediaWiki::API ver. 0.30 to work properly. Im running MediaWiki 1.13 and my simple query is:
use MediaWiki::API;
my $mw = MediaWiki::API->new(); $mw->{config}->{api_url} = 'http://192.168.10.1/wiki15/api.php';
$mw->list ( { action => 'query', list => 'Page1', export => '1', exportnowrap => '1' }) || die $mw->{error}->{code} . ': ' . $mw->{error}->{details};
The returning error is: 2: Failed to decode JSON returned by http://192.168.10.1/wiki15/api.php Decoding Error: malformed JSON string, neither array, object, number, string or atom, at character offset 0 (before "<mediawiki xmlns="ht...") at /usr/lib/perl5/site_perl/5.8.8/MediaWiki/API.pm line 337
... Page1 comes here ...
Grateful for some help.
Regards Claes Lindvall
2010/4/11 Claes Lindvall classe@ekvagen.com:
Hi
Im having trouble to get MediaWiki::API ver. 0.30 to work properly. Im running MediaWiki 1.13 and my simple query is:
use MediaWiki::API;
my $mw = MediaWiki::API->new(); $mw->{config}->{api_url} = 'http://192.168.10.1/wiki15/api.php';
$mw->list ( { action => 'query', list => 'Page1', export => '1', exportnowrap => '1' })
You need to pass format => 'json'
Roan Kattouw (Catrope)
2010/4/11 Roan Kattouw roan.kattouw@gmail.com:
2010/4/11 Claes Lindvall classe@ekvagen.com:
Hi
Im having trouble to get MediaWiki::API ver. 0.30 to work properly. Im running MediaWiki 1.13 and my simple query is:
use MediaWiki::API;
my $mw = MediaWiki::API->new(); $mw->{config}->{api_url} = 'http://192.168.10.1/wiki15/api.php';
$mw->list ( { action => 'query', list => 'Page1', export => '1', exportnowrap => '1' })
You need to pass format => 'json'
Or wait, MediaWiki::API takes care of that. Rather, the problem is with exportnowrap => 1. By passing that parameter you're explicitly asking for the XML not to be wrapped in JSON, on which the JSON parser chokes. Omit this parameter and you should be fine.
Roan Kattouw (Catrope)
Roan Kattouw wrote:
2010/4/11 Roan Kattouw roan.kattouw@gmail.com:
2010/4/11 Claes Lindvall classe@ekvagen.com:
Hi
Im having trouble to get MediaWiki::API ver. 0.30 to work properly. Im running MediaWiki 1.13 and my simple query is:
use MediaWiki::API;
my $mw = MediaWiki::API->new(); $mw->{config}->{api_url} = 'http://192.168.10.1/wiki15/api.php';
$mw->list ( { action => 'query', list => 'Page1', export => '1', exportnowrap => '1' })
You need to pass format => 'json'
Or wait, MediaWiki::API takes care of that. Rather, the problem is with exportnowrap => 1. By passing that parameter you're explicitly asking for the XML not to be wrapped in JSON, on which the JSON parser chokes. Omit this parameter and you should be fine.
Roan Kattouw (Catrope)
Mediawiki-api mailing list Mediawiki-api@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-api
Thank you so much. It helped.
Regards Claes Lindvall
mediawiki-api@lists.wikimedia.org