API:Edit - Register new user
From MediaWiki.org
| This page is part of the MediaWiki API documentation. |
| Language: |
English |
[edit] Creating new User Accounts
MediaWiki version: PROPOSED
RegUser operation allows to create a new account for a user in the MediaWiki Server by passing specific information such as the name, password, domain and email. In the same way as form Login action, sensitive parameters must be passed by POST form.
Sample request and result:
Request
api.php ? action=reguser
Request Post Parameters:
runame=Raquel
rupassword=vodafone
[ rudomain=wikipedia.com]
[ ruemail=raquel.frisa@vodafone.com]
[ rucaptachid = <question> ] Identified of captcha image. Mandatory whenever the ConfirmEdit extension is installed.
[ rucaptchaword=<answer> ] Captcha value. Mandatory wheneverthe ConfirmEdit extension is installed.
In case of Captcha Extensions is installed and these two parameters, rucaptchaid and
rucaptchaword are not included in the request, the result will be “MissingCaptcha”.
When Captcha Extension is installed, the first request will result this response:
Response:
api:
reguser:
result: CaptchaIdGenerated Other values: Exists, Blocked, ReadOnly, BadToken, NoName, EmptyPass,
CaptchaIdGenerated, MissingCaptcha…
captchaId: “1241959345” Captcha Identifier
captchaURL: “/wiki/index.php?title=Especial:Captcha/image&wpCaptchaId=1241959345”
When Captcha Extension is not installed or after the second attempt of action reguser, the result will be the following:
Response:
api:
reguser:
result: Success Other values: Exists, Blocked, ReadOnly, BadToken, NoName, EmptyPass,
CaptchaIdGenerated, MissingCaptcha, etc.
token: 123ABC Also returned as a cookie
username: Raquel Normalized runame, also returned as a cookie
userid: 12345 Also returned as a cookie
Internally, there are two options to create a new user account:
- A logged in user creates a new account. In that case, after performing the action regUser, MediaWiki Server keeps logged in the user with the initial login.
- An anonymous user creates a new account. After performing the operation successfully, the anonymous user will be then logged with the new login name. That is the reason why a token and user id is returned after this operation