My current version of mediawiki installation is 1.32.0. I am trying to use 
Ansible to interface update Mediawiki.

There seems to be some contradictions in the API documentation.


*         The Help:Creating a bot - 
Wikipedia<https://en.wikipedia.org/wiki/Help:Creating_a_bot#Logging_in> says 
that lgname, lgpassword and lgtoken should be used in a POST,

*         while the MediaWiki API 
help<https://www.mediawiki.org/w/api.php?action=help&modules=login> says that 
user id and password should be a part of the URI: 
api.php?action=login&lgname=user&lgpassword=password<https://t-dokuwiki.it.ku.dk/dokuwiki/api.php?action=login&lgname=user&lgpassword=password>.

*         Also API:Main page - 
MediaWiki<https://www.mediawiki.org/wiki/API:Main_page> says that 
"tokens<https://www.mediawiki.org/w/api.php?action=help&modules=tokens> is 
Deprecated. Get tokens for data-modifying actions".

>From the ansible.builtin.uri - Interacts with webservices - Ansible 
>Documentation<https://docs.ansible.com/ansible/latest/collections/ansible/builtin/uri_module.html#examples>,
> the way to POST, is to insert


    body_format: form-urlencoded

    body:

      name: your_username

      password: your_password

      enter: Sign in

which I think must be


- name: Logging in to wiki.server
  uri:
    url: 
https://wiki.server/wiki/api.php?action=query&meta=tokens&type=login&format=json
    method: POST
    force_basic_auth: yes

    body_format: form-urlencoded

    body:

      lgname: your_username

      lgpassword: your_password

      lgtoken: Sign in

but this gives me


"warnings": {

                "main": {

                    "*": "Unrecognized parameters: lgname, lgtoken, lgpassword."

                }

What is the correct documentation?

Your sincerily

Henrik Rasmussen
System administrator


_______________________________________________
Mediawiki-api mailing list
Mediawiki-api@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-api

Reply via email to