File tree Expand file tree Collapse file tree 4 files changed +94
-0
lines changed Expand file tree Collapse file tree 4 files changed +94
-0
lines changed Original file line number Diff line number Diff line change
1
+ //This file is autogenerated. See modules.json and autogenerator.py for details
2
+
3
+ /*
4
+ get_blocked_users.js
5
+
6
+ MediaWiki API Demos
7
+ Demo of `Blocks` module: GET request to list recent blocked users.
8
+
9
+ MIT License
10
+ */
11
+
12
+ var url = "https://en.wikipedia.org/w/api.php" ;
13
+
14
+ var params = {
15
+ action : "query" ,
16
+ list : "blocks" ,
17
+ bklimit : "3" ,
18
+ bkprop : "id|user|by|timestamp|expiry|reason|range|flags" ,
19
+ format : "json"
20
+ } ;
21
+
22
+ url = url + "?origin=*" ;
23
+ Object . keys ( params ) . forEach ( function ( key ) { url += "&" + key + "=" + params [ key ] ; } ) ;
24
+
25
+ fetch ( url )
26
+ . then ( function ( response ) { return response . json ( ) ; } )
27
+ . then ( function ( response ) { console . log ( response . query . blocks ) ; } )
28
+ . catch ( function ( error ) { console . log ( error ) ; } ) ;
Original file line number Diff line number Diff line change
1
+ // This file is autogenerated. See modules.json and autogenerator.py for details
2
+
3
+ /*
4
+ get_blocked_users.js
5
+
6
+ MediaWiki API Demos
7
+ Demo of `Blocks` module: GET request to list recent blocked users.
8
+
9
+ MIT License
10
+ */
11
+
12
+ var params = {
13
+ action : 'query' ,
14
+ list : 'blocks' ,
15
+ bklimit : '3' ,
16
+ bkprop : 'id|user|by|timestamp|expiry|reason|range|flags' ,
17
+ format : 'json'
18
+ } ,
19
+ api = new mw . Api ( ) ;
20
+
21
+ api . get ( params ) . done ( function ( data ) {
22
+ console . log ( data . query . blocks ) ;
23
+ } ) ;
Original file line number Diff line number Diff line change 525
525
"atnamespace" : " 0" ,
526
526
"atlimit" : " 3"
527
527
}
528
+ },
529
+ {
530
+ "filename" : " get_blocked_users" ,
531
+ "docstring" : " Demo of `Blocks` module: GET request to list recent blocked users." ,
532
+ "endpoint" : " https://en.wikipedia.org/w/api.php" ,
533
+ "params" : {
534
+ "action" : " query" ,
535
+ "list" : " blocks" ,
536
+ "bklimit" : " 3" ,
537
+ "bkprop" : " id|user|by|timestamp|expiry|reason|range|flags" ,
538
+ "format" : " json"
539
+ }
528
540
}
529
541
]
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ //This file is autogenerated. See modules.json and autogenerator.py for details
4
+
5
+ /*
6
+ get_blocked_users.php
7
+
8
+ MediaWiki API Demos
9
+ Demo of `Blocks` module: GET request to list recent blocked users.
10
+
11
+ MIT License
12
+ */
13
+
14
+ $ endPoint = "https://en.wikipedia.org/w/api.php " ;
15
+ $ params = [
16
+ "action " => "query " ,
17
+ "format " => "json " ,
18
+ "list " => "blocks " ,
19
+ "bklimit " => "3 " ,
20
+ "bkprop " => "id|user|by|timestamp|expiry|reason|range|flags "
21
+ ];
22
+
23
+ $ url = $ endPoint . "? " . http_build_query ( $ params );
24
+
25
+ $ ch = curl_init ( $ url );
26
+ curl_setopt ( $ ch , CURLOPT_RETURNTRANSFER , true );
27
+ $ output = curl_exec ( $ ch );
28
+ curl_close ( $ ch );
29
+
30
+ $ result = json_decode ( $ output , true );
31
+ var_dump ( $ result ["query " ]["blocks " ] );
You can’t perform that action at this time.
0 commit comments