Limit parameter for feed API, with a value of 50 by default

VERIFIED FIXED

Status

Mozilla Developer Network
API
P1
normal
VERIFIED FIXED
5 years ago
5 years ago

People

(Reporter: openjck, Unassigned)

Tracking

Details

(Whiteboard: c=API, URL)

(Reporter)

Description

5 years ago
Our feed API should provide an optional parameter for limiting the number of results, with a value of 50 by default.
(Reporter)

Updated

5 years ago
Priority: P1 → P2
(Reporter)

Updated

5 years ago
Priority: P2 → P1
(Reporter)

Updated

5 years ago
Whiteboard: c=API → c=API p=2
(Reporter)

Updated

5 years ago
Whiteboard: c=API p=2 → c=API
(Reporter)

Updated

5 years ago
Depends on: 818669
Reference:  https://github.com/mozilla/kuma/pull/674/files

What's an example URL endpoint for this?  I'm not entirely sure where to start with this.
e.g., http://developer.mozilla.org/en-US/docs/feeds/rss/revisions and http://developer.mozilla.org/en-US/docs/feeds/json/revisions powered by https://github.com/mozilla/kuma/blob/master/apps/wiki/feeds.py#L262
FWIW, there's currently a hardcoded limit of 100. Should be pretty easy to change that into a default and honor a query param for a different limit.

But, make sure to add an upper bound to the limit - say, 1000 or something, so that someone requesting the feed can't use ?limit=999999 and try grabbing ALL the things.
Actually, another thought I just had from IRC:

We can have a low ceiling like 50 or 100 items, as long as we also have an ?offset parameter to facilitate pagination through results.

An example use case would be a script that wants to scoop up every page under a certain tag in JSON. It could request 50 results using an offset incrementing by 50, until the results run out.

Comment 5

5 years ago
Commits pushed to master at https://github.com/mozilla/kuma

https://github.com/mozilla/kuma/commit/fdef8f1525197870ff94a5ebb20f59dabd07af27
fix bug 809528 - Add limit param for RSS feeds

https://github.com/mozilla/kuma/commit/5e88792488443637af008978f360725422c71fe2
Merge pull request #751 from darkwing/rss-limit-809528

fix bug 809528 - Add limit param for RSS feeds

Updated

5 years ago
Status: NEW → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
Verified on staging: 50 items by default on https://developer.allizom.org/en-US/docs/feeds/rss/revisions
Verified FIXED on prod now, too: https://developer.mozilla.org/en-US/docs/feeds/rss/revisions -- defaults to 50 items.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.