API:Protect/ja

From MediaWiki.org
Jump to: navigation, search
Tools clipart.png このページは MediaWiki API ドキュメントの一部です。
言語: English  • Deutsch • 日本語
MediaWiki API
MediaWiki バージョン: 1.12

Contents

トークン [edit]

ページの保護レベルを変更するために、protectトークンが必要です。このトークンはeditトークンと等しくすべてのページに対して同じですが、ログインするごとに変わります。protectトークンは次のように取得できます:

ページの保護 [edit]

ページの保護はaction=protextでできます。

パラメータ [edit]

  • title: 保護したいページ。
  • token: 以前のリクエストで取得されたトークン。'+'を'%2B'にurlencodeすることに注意して下さい。
  • protections: action=group、例えばedit=autoconfirmed|move=sysopなどとしてフォーマットされた保護のパイプで区切られた一覧表
    • 保護を取り除きたい場合は、グループとしてallを使います。例えばedit=all|move=sysopです。
    • アクションを除外する場合、関連した値は変わりません。すなわちedit=sysopはmove protectionをそのままにします。
  • expiry: GNUタイムスタンプ形式の期限のタイムスタンプ。The first timestamp applies to the first protection in protections, the second to the second, etc. 'infinite'、'indefinite、'never'、もしくはまったく設定されない場合、保護は期限切れにならなくなります。'next Monday 16:04:57'もしくは'9:28 PM tomorrow'のようなタイムスタンプも許可されます。
    • The number of expiry timestamps must equal the number of protections, or you'll get an error message
      • An exception to this rule is made for backwards compatibility: if you specify exactly one expiry timestamp, it'll apply to all protections
    • Not setting this parameter is equivalent to setting it to infinite
  • reason: 保護(保護解除)の理由(オプション)。
  • cascade: 設定されると、保護されたページにトランスクルードされるページも保護されます。編集するために必要なユーザレベルは保護するために必要なユーザレベルよりも低く(例えばedit=autoconfirmed)、cascadingは有効にできず、このパラメータは暗黙のうちに無視されます。
    • 後者はページを保護することができない人々がcascading保護を持つページでそれらをトランスクルードすることでそれらを保護することをできないようにするということです。

[edit]

Note: In this example, all parameters are passed in a GET request just for the sake of simplicity. However, action=protect requires POST requests; GET requests will cause an error.

起こり得るエラー [edit]

通常のものに加えて、次のものがあります:

  • code: notitle
    • info: titleパラメータを設定しなけれればなりません
  • code: notoken
    • info: tokenパラメータを設定しなければなりません
  • code: noprotections
    • info: protectionsパラメータを設定しなければなりません
  • code: invalidexpiry
    • info: 無効な有効時間
      • 有効なタイムスタンプが無効な形でフォーマットされたもしくは存在しないことを意味します(例えばNovember 31もしくは24:05)。
  • code: pastexpiry
    • info: 有効時間は過ぎました
  • code: toofewexpiries
    • info: number expiry timestamps were provided where number were needed
      • Note that this error is misnamed: it's also thrown when you specify too many expiry times
  • code: cantedit
    • info: このページを編集できないので保護できません
  • code: create-titleexists
    • info: 既存のタイトルは'create'で保護できません
  • code: missingtitle-createonly
    • info: 見つからないタイトルは'create'でのみ保護できます
  • code: protect-invalidaction
    • info: Invalid protection type ``type''
  • code: protect-invalidlevel
    • info: Invalid protection level ``level''