Extension:GlobalBlocking/API
Global blocking edit
Allows you to create a new block, remove a block, or modify one.
Parameters edit
target
: Target IP address/rangeexpiry
: How long block should last forunblock
: If set, will unblock the address/rangereason
: (un)block reasonanononly
: If set, the block will only affect anonymous usersmodify
: If set, the block will modify an existing blocktoken
: Edit token
Example edit
Note: Request must be POSTed.
Blocking 127.0.0.1 indefinitely with the reason of "Cross wiki abuse"
Result |
---|
<?xml version="1.0"?>
<api>
<globalblock user="127.0.0.1" blocked="" expiry="infinite" />
</api>
|
List global blocks edit
View a list of currently blocked IP addresses/ranges.
Parameters edit
bgstart
: The timestamp to start enumerating frombgend
: The timestamp to stop enumerating atbgdir
: The direction in which to enumerate (older, newer)bgids
: Pipe-separated list of block IDs to list (optional)bgaddresses
: Pipe-separated list of addresses to search for (optional)bgip
: Get all blocks applying to this IP or CIDR range, including range blocks. (Cannot be used together with bkusers. IPv4 CIDR ranges broader than /16 are not accepted; however, IPv6 ranges can be of any size less than /4)bglimit
: The maximum number of blocks to listbgprop
: Which properties to get (id|address|by|timestamp|expiry|reason|range)
Errors codes edit
cidrtoobroad
: CIDR ranges broader than /16 are not accepted.invalidtitle
: Bad title 'title'.readapidenied
: You need read permission to use this module.
Example edit
List all global blocks
Result |
---|
<api>
<query-continue>
<globalblocks bgstart="2009-10-03T12:10:59Z" />
</query-continue>
<query>
<globalblocks>
<block id="2301" address="82.49.115.227" />
<block id="2297" address="59.86.157.24" anononly="" />
<block id="2296" address="83.79.31.175" anononly="" />
<block id="2287" address="81.18.116.66" />
<block id="2286" address="141.223.237.76" />
<block id="2280" address="125.184.11.164" />
<block id="2279" address="124.197.47.74" />
<block id="2278" address="115.139.25.18" />
<block id="2277" address="111.92.160.26" />
<block id="2276" address="89.248.172.146" />
</globalblocks>
</query>
</api>
|
The following documentation is the output of Special: |
action=globalblock
- This module requires read rights.
- This module requires write rights.
- This module only accepts POST requests.
- Source: GlobalBlocking
- License: GPL-2.0-or-later
Globally block or unblock a user.
- target
The target IP address.
- This parameter is required.
- expiry
If specified, will block or reblock the user. Determines how long the block will last for, e.g. "5 months" or "2 weeks". If set to "infinite" or "indefinite" the block will never expire.
- Type: expiry (details)
- unblock
If specified, will unblock the user.
- Type: boolean (details)
- reason
The reason for blocking/unblocking.
- This parameter is required.
- anononly
Specify this if the block should only affect logged-out users globally.
- Type: boolean (details)
- modify
Specify this if the existing block on the target should be modified
- Type: boolean (details)
- alsolocal
Block the IP locally as well
- Type: boolean (details)
- localblockstalk
Revoke talk page access locally
- Type: boolean (details)
- localblocksemail
Revoke email access locally
- Type: boolean (details)
- localanononly
Specify this if the block should only affect logged-out users locally.
- Type: boolean (details)
- token
A "csrf" token retrieved from action=query&meta=tokens
- This parameter is required.
- Block 192.0.2.1 indefinitely with reason "Cross-wiki abuse"
- api.php?action=globalblock&target=192.0.2.1&expiry=indefinite&reason=Cross-wiki%20abuse&token=123ABC [open in sandbox]