When list=allusers is used with auactiveusers, a property 'recenteditcount'
is returned in the result. In bug 67301[1] it was pointed out that this
property is including various other logged actions, and so should really be
named something like "recentactions".
Gerrit change 130093,[2] merged today, adds the "recentactions" result
property. "recenteditcount" is also returned for backwards compatability,
but will be removed at some point during the MediaWiki 1.25 development
cycle.
Any clients using this property should be updated to use the new property
name. The new property will be available on WMF wikis with 1.24wmf12, see
https://www.mediawiki.org/wiki/MediaWiki_1.24/Roadmap for the schedule.
[1]: https://bugzilla.wikimedia.org/show_bug.cgi?id=67301
[2]: https://gerrit.wikimedia.org/r/#/c/130093/
--
Brad Jorsch (Anomie)
Software Engineer
Wikimedia Foundation
_______________________________________________
Mediawiki-api-announce mailing list
Mediawiki-api-announce(a)lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-api-announce
Hi everyone,
I'm trying to login using the MediaWiki API. This works if I copy the token manually in the code every time again. Using the token from the variable DOESNT work, but copy pasting the same token into the TOKEN= assignment (into the source code) DOES work!
After that, I'm trying to edit a page. I have the same problem with the edit token. It cannot be read from the variable, unless I copied the token manually to the variable in the source code :(
I know I'm almost there, but the tokens are getting in the way.
Why doesn't it work when I'm parsing the token from the API? When I copy-paste the same token into the source code directly it works..
The token looks the same to me! Is curl getting in the way here? I tried several things, like dropping the last \ from the token and then passing it to curl, but to no avail.
Output of the script when it doesn't work (reading the token from the TOKEN variable when parsing from the API):
$ ./clientcode.sh
UTF8 check: ☠
Logging into https://nl.wikipedia.org/w/api.php as Smile4ever...
Get login token...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 112 100 112 0 0 649 0 --:--:-- --:--:-- --:--:-- 666
{
"batchcomplete": "",
"query": {
"tokens": {
"logintoken": "9b9a82c7ac27cf9573e1c7cb7419cf53589041ec+\\"
}
}
}
Login token is "9b9a82c7ac27cf9573e1c7cb7419cf53589041ec+\\"
-----
Logging in...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 302 100 142 100 160 829 935 --:--:-- --:--:-- --:--:-- 958
{
"error": {
"code": "badtoken",
"info": "Invalid CSRF token.",
"*": "See https://nl.wikipedia.org/w/api.php for API usage."
},
"servedby": "mw1288"
}
Unable to login, is logintoken "9b9a82c7ac27cf9573e1c7cb7419cf53589041ec+\\" correct?
==========================================
Output of the script when it does work (reading the token from the TOKEN variable when using a fixed value for the login token):
$ ./clientcode.sh
UTF8 check: ☠
Logging into https://nl.wikipedia.org/w/api.php as Smile4ever...
Get login token...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 111 100 111 0 0 642 0 --:--:-- --:--:-- --:--:-- 660
{
"batchcomplete": "",
"query": {
"tokens": {
"logintoken": "7bfac90f99869aeb77fee2646d0022f1589040d3+\\"
}
}
}
Login token is 3e929f9275d81f12a1f7c93e1beec99f589040b4+\
-----
Logging in...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 224 100 76 100 148 36 71 0:00:02 0:00:02 --:--:-- 72
{
"clientlogin": {
"status": "PASS",
"username": "Smile4ever"
}
}
Successfully logged in as Smile4ever, STATUS is "PASS"
Script:
#!/usr/bin/env bash
#Needs curl
USERNAME="Smile4ever"
USERPASS="******"
WIKIAPI="https://nl.wikipedia.org/w/api.php"
cookie_jar="wikicj"
#Will store file in wikifile
echo "UTF8 check: ☠"
#################login
echo "Logging into $WIKIAPI as $USERNAME..."
###############
#Login part 1
#printf "%s" "Logging in (1/2)..."
echo "Get login token..."
CR=$(curl -S \
--location \
--retry 2 \
--retry-delay 5\
--cookie $cookie_jar \
--cookie-jar $cookie_jar \
--user-agent "Curl Shell Script" \
--keepalive-time 60 \
--header "Accept-Language: en-us" \
--header "Connection: keep-alive" \
--compressed \
--request "GET" "${WIKIAPI}?action=query&meta=tokens&type=login&format=json")
echo "$CR" | jq .
rm login.json
echo "$CR" > login.json
TOKEN=$(jq '.query.tokens.logintoken' login.json)
#TOKEN="${TOKEN//\"/}" #replace double quote by nothing
#Remove carriage return!
#printf "%s" "$TOKEN" > token.txt
#TOKEN=$(cat token.txt | sed 's/\r$//')
#TOKEN="$(<token.txt)"
#TOKEN="${TOKEN//\+\\/\+}" #replace +\ by +
#echo -n $TOKEN > token.txt
#TOKEN="${TOKEN//\+\\/%2b%5c}" #replace +\ by %2b%5c
#TOKEN="33bf0c310b22a836be6b28905470d3a1589031da+\\"
#TOKEN="24949330db743d9af74e7e56f2b523725890407b+\\"
if [ "$TOKEN" == "null" ]; then
echo "Getting a login token failed."
exit
else
echo "Login token is $TOKEN"
echo "-----"
fi
###############
#Login part 2
echo "Logging in..."
CR=$(curl -S \
--location \
--cookie $cookie_jar \
--cookie-jar $cookie_jar \
--user-agent "Curl Shell Script" \
--keepalive-time 60 \
--header "Accept-Language: en-us" \
--header "Connection: keep-alive" \
--compressed \
--data-urlencode "username=${USERNAME}" \
--data-urlencode "password=${USERPASS}" \
--data-urlencode "rememberMe=1" \
--data-urlencode "logintoken=${TOKEN}" \
--data-urlencode "loginreturnurl=http://google.be" \
--request "POST" "${WIKIAPI}?action=clientlogin&format=json")
echo "$CR" | jq .
STATUS=$(echo $CR | jq '.clientlogin.status')
if [[ $STATUS == *"PASS"* ]]; then
echo "Successfully logged in as $USERNAME, STATUS is $STATUS."
echo "-----"
else
echo "Unable to login, is logintoken ${TOKEN} correct?"
exit
fi
###############
#Get edit token
echo "Fetching edit token..."
CR=$(curl -S \
--location \
--cookie $cookie_jar \
--cookie-jar $cookie_jar \
--user-agent "Curl Shell Script" \
--keepalive-time 60 \
--header "Accept-Language: en-us" \
--header "Connection: keep-alive" \
--compressed \
--request "POST" "${WIKIAPI}?action=query&meta=tokens&format=json")
echo "$CR" | jq .
echo "$CR" > edittoken.json
EDITTOKEN=$(jq '.query.tokens.csrftoken' edittoken.json)
rm edittoken.json
EDITTOKEN="${EDITTOKEN//\"/}" #replace double quote by nothing
#EDITTOKEN="${EDITTOKEN//\+\\/\+}" #replace +\ by +
if [[ $EDITTOKEN == *"+\\"* ]]; then
echo "Edit token is: $EDITTOKEN"
else
echo "Edit token not set."
exit
fi
###############
#Make a test edit
#EDITTOKEN="d55014d69f1a8c821073bb6724aced7658904018+\\"
CR=$(curl -S \
--location \
--cookie $cookie_jar \
--cookie-jar $cookie_jar \
--user-agent "Curl Shell Script" \
--keepalive-time 60 \
--header "Accept-Language: en-us" \
--header "Connection: keep-alive" \
--compressed \
--data-urlencode "title=Gebruiker:Smile4ever/test4" \
--data-urlencode "appendtext={{nocat|2017|01|31}}" \
--data-urlencode "token=${EDITTOKEN}" \
--request "POST" "${WIKIAPI}?action=edit&format=json")
echo "$CR" | jq .
Kind regards,
Geoffrey De Belie
Hi again,
Is there a way to get a localized version of section names of an article,
for example "See also"? Currently my question is related to section names,
but in general I would like to get language equivalent for other semantic
entities. Are there docs about such things? I tried to find but failed.
Thanks,
Max
Hi,
I am Ben, a developer in Taiwan. While I was developing some services based on API:Opensearch, I found that the response of the same url request can be either Simplified Chinese or Traditional Chinese. To be more specific, I would love to know how can I determine the response language form from API layer ( Or other factors that may have impact ) ? Since the document of API:Opensearch doesn't seem to take language into consideration,
many thanks :)
Hi All,
in a wikimedia commons page like this one
https://commons.wikimedia.org/wiki/File:Maradona_at_2012_GCC_Champions_Leag…
is there a way to extract links from paragraph "File usage on other wikis"
through API?
I'm trying a lot of combination with the api sandbox but whitout success.
I need to know in which wikipedia pages that image is used.
Thank you,
Luca
That's right! At the Wikimedia Developer Summit, we decided to organize a
Developer Wishlist Survey, and here we go:
https://www.mediawiki.org/wiki/Developer_Wishlist
The Wikimedia technical community seeks input from developers for
developers, to create a high-profile list of desired improvements. The
scope of the survey includes the MediaWiki platform (core software, APIs,
developer environment, enablers for extensions, gadgets, templates, bots,
dumps), the Wikimedia server infrastructure, the contribution process, and
documentation.
The best part: we want to have the results published by Wednesday, February
15. Yes, in a month, to have a higher chance to influence the
Wikimedia Foundation annual plan FY 2017-18.
There's no time to lose. *Propose your ideas before the end of January, *
either by pushing existing tasks in Phabricator or by creating new ones.
You can find instructions on the wiki page
<https://www.mediawiki.org/wiki/Developer_Wishlist>. Questions and feedback
are welcome especially on the related Talk page.
The voting phase is expected to start on February 6 (tentative). Watch this
space (or even better, the wiki page).
Cheers,
Srishti Sethi
Developer Advocate, Technical Collaboration team
Wikimedia Foundation
https://www.mediawiki.org/wiki/User:SSethi_(WMF)
Hi,
I'm not able to login using clientlogin. Any help is appreciated. Below things I've already tried:
POST https://nl.wikipedia.org/w/api.php?action=query&meta=tokens&type=lo…
Output:
{
"batchcomplete": "",
"query": {
"tokens": {
"logintoken": "85af2296d03f8ce504123b7733b0a7ad5880c782+\\"
}
}
}
POST https://nl.wikipedia.org/w/api.php?action=clientlogin&loginreturnurl=ht…
Input (text/plain):
logintoken=85af2296d03f8ce504123b7733b0a7ad5880c782+\\&username=Smile4ever&password=*******&rememberMe=1
Output:
{
"error": {
"code": "badtoken",
"info": "Invalid CSRF token.",
"*": "See https://nl.wikipedia.org/w/api.php for API usage."
},
"servedby": "mw1288"
}
Input (application/json):
{
"logintoken": "85af2296d03f8ce504123b7733b0a7ad5880c782+\\",
"username": "Smile4ever",
"password": "*******"
}
Output:
{
"error": {
"code": "notoken",
"info": "The \"token\" parameter must be set.",
"*": "See https://nl.wikipedia.org/w/api.php for API usage."
},
"servedby": "mw1278"
}
window.onbeforeunload = function() {}
Kind regards,
Geoffrey De Belie