API:Account creation/pre-1.27/ja

アカウント作成
APIを使ってアカウントを作成することができます. あなた自身のために新しいアカウントを作成することもできますし、他の誰かのためにランダムなパスワードを本人にメールで送信して作成することもできます. アカウントの作成はSpecial:log/newusersに記録されます. もしログインしていれば、あなたの利用者名もアカウントを作成するときに記録されます.

パラメーター

 * : 利用者名
 * : パスワード (ignored if  is set)
 * : Domain for external authentication (optional)
 * : Account creation token obtained in first request
 * : Email address of user (Optional unless mailpassword is set)
 * : Real name of user (Optional. Additionally many wikis have realname disabled via $wgHiddenPrefs)
 * Note: To check whether  is enabled or not, request  . If you get no   property back in the response,   is a hidden preference.
 * : If set to any value, a random password will be generated and e-mailed to the user (instead of using the  parameter)
 * : Optional reason for creating the account. Will be shown in the account creation log (example).
 * : Language code to set as default for the user

Extended parameters when used with Extension:ConfirmEdit:
 * : Previously-provided CAPTCHA ID to send with followup request, if captcha was required
 * : User-provided answer of CAPTCHA to send with followup request, if captcha was required

トークン
アカウントを作成するにはトークンが必要です. トークンを取得するには、トークンの部分を未入力にしてリクエストを送信します. トークンを取得したら、もう一度トークンを入力してそのリクエストを送信します. これはログインモジュールの使い方と似ています. 詳細は以下の例をご覧ください.

例
注記: 簡潔性のためにこの例ではすべてのパラメーターをGETリクエストで渡していますが, action=createaccount はPOSTリクエストを必要とします; GETリクエストだとエラーが発生します.

We should now receive a response like:

We take the token given here, and add it to the request:

Assuming everything works, we should get a result like:

And GymBeauWhales@wikipmediawiki.net would get an email with instructions on how to log in.

CAPTCHA
When used with Extension:ConfirmEdit, a CAPTCHA may be presented for new account creations. This is supported via extension in the API here.

When submitting per the above rules and receiving a response, you may also receive a  node in the return data, similar to what is sometimes returned by action=edit.

For a text-based CAPTCHA:

For an image-based CAPTCHA:

Be aware that the URL may be site-relative or protocol-relative.

As of the current code (see ) you won't receive the captcha prompt response until after basic validation errors have been taken care of.

起こりうる出力
The result attribute can have one of three values:
 * needtoken: A token is needed. A token parameter should also be set with a token to use.
 * If you get a needtoken result when you are expecting a success result, make sure the token you are sending is correct, and that you are sending along any cookies sent by the API.
 * success: Everything worked
 * warning: Not used in core, however extensions can (in theory) add warnings, in which case the result attribute will be warning. However, this still generally means the account was created successfully.
 * warning: Not used in core, however extensions can (in theory) add warnings, in which case the result attribute will be warning. However, this still generally means the account was created successfully.
 * warning: Not used in core, however extensions can (in theory) add warnings, in which case the result attribute will be warning. However, this still generally means the account was created successfully.

起こりうるエラー
All errors are formatted as: Many of the info codes to this module correspond to system messages. As a result the info part may change and in particular will vary with language.

無効化
このAPIの機能を無効化するには、以下の行を設定ファイルに追加します:

関連項目

 * How to restrict API usage
 * Enable/Disable (write) API
 * Extension:SignupAPI/ja from 2011: in order to implement a Special:UserSignup form with an AJAX-y interactive validation, this extension also implements action=signup and action=validatesignup APIs.