NOTE: Remove sections that are not needed. Instead, leave the section and write NOT NEEDED as its content.
Background: The worklist feature requires a public REST API endpoint so external consumers can retrieve the list of articles in an event's worklist. Note: the frontend article list table (task-9) does NOT use this endpoint — it uses server-side rendering. This endpoint is for the public API surface and external consumers.
Type of story
- Backend
Acceptance criteria
- A REST API handler exists for GET /campaignevents/v0/event_registration/{id}/worklist.
- The endpoint accepts optional query parameters limit (default 20) and offset (default 0).
- A successful response returns HTTP 200 with a JSON body: { "articles": [ { "id": <int>, "page_title": "<string>", "wiki_id": "<string>", "added_by_user_id": <int>, "added_at": "<timestamp>" } ], "total": <int> }.
- If the event does not exist, the endpoint returns HTTP 404.
- Unit tests cover: 200 paginated response, 404 event not found.
Error messages and copy included
- For happy path: NOT NEEDED
- For unhappy path:
- Message key: campaignevents-rest-get-worklist-not-found
- Message text: TBD
- Message suggestion: "There is no event registration with this ID."
- Context: shown as the HTTP 404 error body when the {id} path parameter does not correspond to an existing event registration
- Message key: campaignevents-rest-get-worklist-not-found
Depends on
Testing required?
- Yes
- Minimum testing to pass QA: Unit tests for 200 (paginated response) and 404 (event not found).
Technical details
- Implement the GET handler and register the route following the extension’s existing REST conventions.
- Return 404 when the event registration does not exist.
Split patches suggestion
- Branch 1: handler class + route registration in extension.json + unit tests
API documentation
- The endpoint must be documented at: Extension:CampaignEvents/Api
- Route: GET /campaignevents/v0/event_registration/{id}/worklist
- Method: GET
- Authentication: optional (public endpoint; no auth required to read)
- Path parameters:
- id (integer, required): the internal ID of the event registration
- Query parameters:
- limit (integer, optional, default: 20, max: 500): number of articles to return
- offset (integer, optional, default: 0): zero-based offset for pagination
- If limit or offset is sent but is not a valid integer: HTTP 400 — MediaWiki REST / ParamValidator rejects the request before the handler runs.
- Success response — HTTP 200: `json { "articles": [ { "id": 1, "page_title": "Main_Page", "wiki_id": "enwiki", "added_by_user_id": 7, "added_at": "2026-04-14T12:00:00Z" } ], "total": 1 } `
- Error responses:
- 404 Not Found — event registration with the given id does not exist (campaignevents-rest-get-worklist-not-found).
Gherkin scenarios
NOTE: This are all drafts and we will refine them
Feature: REST API GET /worklist — list worklist articles
- Scenario: Successful paginated response
- Given event registration 42 exists and has 5 articles in its worklist
- When a GET request is made to /campaignevents/v0/event_registration/42/worklist?limit=3&offset=0
- Then the response status is 200
- And the response body contains an "articles" array with 3 items
- And each item has fields: id, page_title, wiki_id, added_by_user_id, added_at
- And the response body contains "total": 5
- Scenario: Paginated response — second page
- Given event registration 42 exists and has 5 articles in its worklist
- When a GET request is made to /campaignevents/v0/event_registration/42/worklist?limit=3&offset=3
- Then the response status is 200
- And the response body contains an "articles" array with 2 items
- And the response body contains "total": 5
- Scenario: Default pagination when no parameters provided
- Given event registration 42 exists and has 5 articles in its worklist
- When a GET request is made to /campaignevents/v0/event_registration/42/worklist
- Then the response status is 200
- And the response body contains an "articles" array with 5 items
- Scenario: Event not found returns 404
- Given no event registration with id 9999 exists
- When a GET request is made to /campaignevents/v0/event_registration/9999/worklist
- Then the response status is 404
- Scenario: Empty worklist returns empty array
- Given event registration 42 exists and has no articles in its worklist
- When a GET request is made to /campaignevents/v0/event_registration/42/worklist
- Then the response status is 200
- And the response body contains an "articles" array with 0 items
- And the response body contains "total": 0