Add limit parameter to API

Issue #2 resolved
MusikAnimal created an issue

Is there a way to limit the number of pages returned by the API? For instance Pile 3030 has 690,381 pages, with a download size of nearly 2MB! With Massviews anyway, we are only going to show the first 500.

My hope is we can put the total number of pages in the metadata, then allow for a limit parameter to get back on N pages.

So:

https://tools.wmflabs.org/pagepile/api.php?id=3030&action=get_data&format=json&metadata=1&limit=500

which will give us:

{
  "pages": {
    ...500 pages...
  },
  "wiki": "wikidatawiki",
  "id": 3030,
  "length": 690381
}

This will most importantly speed things up and reduce download size as we'd only get the first 500, but also I could throw the error "There are 690,381 pages, only the first 500 will be processed".

Comments (2)

  1. Log in to comment