I'm trying to use the Mediawiki API to get information about revisions
to a given page. I understand that it is possible to get the entire
contents of a given revision. However I would like to know if it is
possible to only get the diffs introduced in a given revision? This
would result in a reduced bandwidth consumption.
My goal is to get the most frequently used terms in a set of revisions
to a given page. For instance, for the web page Wikipedia what were
the most common terms in all revisions between 2007-09 and 2007-11.
Thanks in advance for any comments on this issue,
Using cookies and last version of API modules found using URL
query is now working fine.
Thanks for your help.
Roan Kattouw <roan.kattouw(a)home.nl>
Sent by: mediawiki-api-bounces(a)lists.wikimedia.org
Please respond to MediaWiki API announcements & discussion
To: MediaWiki API announcements & discussion
Subject: Re: [Mediawiki-api] Action Query failed due to errorcode
> Then I try to retrieve the token of one page using query action with
> following parameters:
You used the lg* parameters to stay logged in, which isn't possible any
more due to security concerns. The docs hadn't been updated yet, I did
so upon seeing your e-mail. The correct way to stay logged in is to
fetch the cookies from the action=login request and pass them back to
all subsequent requests. An example of how to do this in PHP using
Snoopy is linked to from the External links section of the login
Roan Kattouw (Catrope)
Mediawiki-api mailing list
I am trying to update/create articles on our Wiki using the mediawiki API
(using last version found on http://svn.wikimedia.org/viewvc/mediawiki/trunk/phase3/includes/api)
Login phase (action=login) works correctly and returns <LoginToken> and
Then I try to retrieve the token of one page using query action with
Unfortunatelly, I always get the following response (xml format), what
ever the login used (even if user has Sysopt rights):
<?xml version="1.0" encoding="utf-8"?><api><error
code="inpermissiondenied" info="Action 'edit' is not allowed for the
current user" /></api>
I don't understand this error and don't find documentation about it.
Do I need to configure a specific parameter on Wiki to allow "edit" ?
Thanks for your help.
I propose to make same limits (500 on slow and 5000 on fast queries) to
all users for all actions (maybe expect content requests). Reasons:
1. It would be less expensive to fetch 500 (5000) rows on *one query*
than to do *10 times the same query.
2. Usually it's very hard to determine if you may use extended limits
(for now it's group "sysop" (you won't beleive me, but may not exist on
wiki) or "bot" right). I propose to at least add new user right called
"apihighlimits". Anyway, it cause user to do extra query.
I noticed that the live wikimedia servers now have a version of the API
that respects the maxlag parameter, which is great. Thanks to the people
who got that working.
The correct action when getting a maxlag error is to sleep for at least
as long as the current lag. A nice feature of the HTTP maxlag error
produced by index.php is that an HTTP header 'Retry-After' that directly
tells how long to wait.
I looked at the API code this afternoon to see if I could add another
field to the error object that would directly include the lag, so that
I don't have to parse it out of the text of the info field. I dicovered
that the error objects at the moment can only have two fields, 'code'
That explained to me why bug 11404 was resolved the way it was. In that
bug, there was no easy way to distinguish between different sorts of
internal errors without parsing the info field. It was resolved by
changing the error code to directly reflect the type of internal error
I don't mind writing a patch to permit different instances of
UsageException to carry extra information in addition to 'code' and
'info', but I don't want to invest the coding time unless other people
think it's worthwhile.
First off, nice work on the API :-) Nice structure, quite simple to extend.
I'm building an API module for the wikidata extension, which will
basically provide an XML interface to wikidata terms. In doing so I ran
into a couple of issues that I hope somebody on this list can help me with.
My first question is: how do I place an API module in an extension?
Wikidata has it's own branch, so I can simply put my API module and it's
formatters in the includes/api directory and modify both
includes/api/ApiMain.php and includes/AutoLoader.php. But I'd much
rather put my code in the Wikidata extension and not modify anything in
the branch. I found an svn commit that suggests that this is possible,
but I fail to see how.
My second question is: how can a custom printer learn about the format
parameter passed in the request?
My module uses it's own formatter. I created one for several reasons,
one being that I had trouble getting a big data structure into the
ApiResult object. Maybe I just didn't understands the interface. That
wasn't the only reason, I felt like I needed an different internal
representation. Anyway, there's a nice hook for creating a custom
printer: the getCustomPrinter method. But unfortunately that method
doesn't get the value of the format parameter passed in. My module can
format different types of output, but right now I have to solve this by
adding my own format parameter (which gets prefixed with 'wd' for
wikidata). Is there any way I can find out what that parameter was?
*Maarten van Hoof*
*Edia* - Educatie Technologie
Asterweg 19D12 | 1031 HL Amsterdam
*T* 020 716 36 12 | *F* 020 716 36 13 | *M* 06 245 392 15 | www.edia.nl
I know there was some discussion about changing the parameter, so maybe this
is just the code being worked out, but the query for backlinks seems to be
broken - even the example on the API help returns nothing.
( 877 ) 406 - 6272 [toll free]
"There is more than one right way .. to make it perfect!"
i am new here and I have one question, is there an API client for PHP
available? Maybe stupid, but I need one to communicate (read&write) with
mediawiki from another project, written in php ;-)
Why you dont use SOAP or XML-RPC?
Greetings from Germany
Tel. 0178 4860018