Use list=blocks to return all single IP blocks in a CIDR
Open, Needs TriagePublic

Description

Problem
To find all the single IP blocks in a given CIDR using query&list=blocks you need to pass all possible IP addresses.

Feature request
Extending on the functionality of blocks&bkip= (which returns a result only if the queried CIDR falls within an existing blocked range), we should also return all single IP blocks in a provided CIDR.

Example
https://en.wikipedia.org/w/api.php?action=query&format=json&list=blocks&bkip=170.24.138.0/24 would return all single IP blocks in the CIDR 170.24.138.0/24 as;

{
	"batchcomplete": "",
	"query": {
		"blocks": [{
			"id": 8067923,
			"user": "170.24.138.57",
			"by": "Gilliam",
			"timestamp": "2017-12-13T06:28:59Z",
			"expiry": "2017-12-20T06:28:59Z",
			"reason": "{{school block}}",
			"anononly": "",
			"nocreate": "",
			"allowusertalk": ""
		}, {
			"id": 8083937,
			"user": "170.24.138.53",
			"by": "Oshwah",
			"timestamp": "2017-12-19T19:37:20Z",
			"expiry": "2018-01-19T19:37:20Z",
			"reason": "{{school block}}",
			"anononly": "",
			"nocreate": "",
			"allowusertalk": ""
		}]
	}
}
Samtar created this task.Dec 19 2017, 9:58 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptDec 19 2017, 9:58 PM
Samtar updated the task description. (Show Details)Dec 19 2017, 10:00 PM
Anomie added a subscriber: Anomie.Dec 20 2017, 2:54 PM

Extending on the functionality of blocks&bkip= (which returns a result only if the queried CIDR falls within an existing blocked range), we should also return all single IP blocks in a provided CIDR.

That would be confusing. bkip should either return all blocks that apply to the passed IP or range, or all blocks contained in the passed IP or range. Since it already does the former, we shouldn't add the latter behavior.

Instead a new parameter should be added for the new functionality of requesting all blocks contained within a CIDR range.

Anomie moved this task from Unsorted to Needs Code on the MediaWiki-API board.Dec 20 2017, 2:55 PM