Hi
I admit I'm not the sharpest perlprogrammer in the world, so I need
some help here.
I'm trying to automate some things and I want to use MediaWiki::API.
My final goal is to write an exportscript that export all pages in
some categories and then an importscript that import the xml-file on
another wiki.
When I run the script below I get the following error:
Use of uninitialized value in print at get_export.pl line 15.
But if I run it from my webbrowser I get the result:
api.php?action=query&generator=categories&titles=Page1
<?xml version="1.0" encoding="utf-8"?>
<api>
<query>
<pages>
<page pageid="5" ns="14" title="Category:Teologi" />
</pages>
</query>
</api>
The Script:
use MediaWiki::API;
binmode STDOUT, ':utf8';
my $mw = MediaWiki::API->new();
$mw->{config}->{api_url} = 'http://192.168.10.1/wiki3/api.php';
# log in to the wiki
$mw->login( { lgname => 'WikiSysop', lgpassword => 'xxxxxx' } )
|| die $mw->{error}->{code} . ': ' . $mw->{error}->{details};
if ( my $ref = $mw->api( { action => 'query', generator =>
'categories', titles => 'Page1'} )) {
print $ref->{query}->{pages}->{page}->{ns};
}
What is wrong with my script (or me)?
Kindly Regards
Claes
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
I'm trying to do build a system which is described below.
"The user inputs a word. The system check if word exists at portuguese
section of wiktionary. If true,
get and show to user the word definiton. If false, sugest (displays) similar
words, as in Wiktionary,
with her links."
I have done this
http://troyee.com/example/sl_project_36/index.php
using this api
http://en.wiktionary.org/w/api.php?action=opensearch&search=api&format=xml&…
*it is for english word.
Now I stuck with two questions
1. Am I going to the right way?
2. how to handle with portuguese section of wiktionary. which api will use
for this?
I need your useful suggestions please.
-----
Regards
Saeed Ahmed
http://saeed05.wordpress.com
-----
(Note that this is about Flagged Protection, which is not exactly the
same as FlaggedRevs. Forwarding it here since interested API people
may not be on foundation-l.)
---------- Forwarded message ----------
From: Voice of All <jschulz_4587(a)msn.com>
Date: Thu, Apr 8, 2010 at 1:00 AM
Subject: [Foundation-l] Flagged Protection API
To: foundation-l(a)lists.wikimedia.org
As you may know, there is a planned trial of FlaggedRevs on English
Wikipedia. The proposal page can be found at WP:FPPR. People interested in
writing user tools that interact with FlaggedRevs components will of course
want to use the API. A reasonable documentation of the existing pages is
provided at www.mediawiki.org/wiki/Extension:FlaggedRevs#API.
Anyone interested in testing of these pages should visit
flaggedrevs.labs.wikimedia.org to try out these components. It may help to
first browse the regular GUI to get a feel for what is going on. Problem
reports and feature request should go on Wikimedia:FlaggedRevs_issues/API
(on that wiki).
A few quick notes specific to the flaggedrevs.labs site:
* API page "action = review"
* Use flag_status (1 or 0) not flag_accuracy (each wiki can have it's own
tag names)
* API page "action = stabilize"
* Use protectlevel (none, autoconfirmed, or review)
* Analogous to "publish" restriction GUI at action=protect
--
View this message in context:
http://old.nabble.com/Flagged-Protection-API-tp28174134p28174134.html
Sent from the WikiMedia Foundation mailing list archive at Nabble.com.
_______________________________________________
foundation-l mailing list
foundation-l(a)lists.wikimedia.org
Unsubscribe: https://lists.wikimedia.org/mailman/listinfo/foundation-l
hello friends,
I'm totally new with wiki api. I want your help.
I want to get a word definition from wiki using wiki api. the system is
below
input a word -> get the definition from wiki .
I am reading this http://en.wiktionary.org/w/api.php . but could not get it
well. I do understand how to implement it.
-----
Regards
Saeed Ahmed
http://saeed05.wordpress.com
-----
This security upgrade has caused issue with my application:
The Bugzilla page indicates that the cookie is returned with the first
login request. I never used/stored this HTTP cookie, but instead built
the cookie using the "enwiki_session=","enwikiUserID=", and other
response fields.
These fields are no longer present in the first HTTP response (or the
second -- which fails due to lack of cookie). Is this functionality we
should expect to return?
Thanks, -AW
--
Andrew G. West, Doctoral Student
Dept. of Computer and Information Science
University of Pennsylvania, Philadelphia PA
Email: westand(a)cis.upenn.edu
Website: http://www.cis.upenn.edu/~westand
The SiteInfo query currently provides all sorts of version numbers for the
DB, the PHP install itself, etc..., but the one version number that
*I*would find useful would be the version string from Parser.php.
My memory about variable scope in PHP is a bit fuzzy, so I'm not positive if
the code in Parser.php itself would need to be changed. The variable
containing it's version string is a const named VERSION, located on line 55
(according to the line numbering in the ViewVC online code listing, at
least).
It'd kind of suck to need to change that in order to implement this but...
well, personally I'd find the version number of Parser.php (and possibly
some other internal version numbers) much more useful then the version
numbers that are currently provided.
Regards,
Nolan (aka User:Ohms law)
Regarding the suggestion to return the pageid of deleted pages: I don't mind
if this is implemented somehow, but there needs to be something that changes
if the page has actually been deleted. It would be easy enough for me to
change, but the current behavior, where the pageid isn't returned, is a
behavior that I currently rely on. Something needs to say that, despite the
fact that the pageid is being return, the page itself is in a deleted state.
Regards,
Nolan
I'm looking for a way to return parsed wikitext without [edit] links
or any other text that mediawiki returns only while logged in. In
other words, I want action=parse to return parsed wikitext as if a
logged in user was not logged in. Is this possible?
Thanks,
Jim