Page MenuHomePhabricator

โ›“๏ธโ€๐Ÿ’ฅ Remove a sitelink for a given wiki
Closed, ResolvedPublic8 Estimated Story Points

Description

As a tool developer I want to be able to remove old or wrong information about a sitelink of a specific wiki on an item

DELETE entities/items/{item_id}/sitelinks/{site_id}

Acceptance criteria:

  • On the successful removal, API should respond with 200 and "sitelink deleted" as a response body.
  • Following error cases have to be considered:
HTTP response coderesponse payload
Item does not exist404"code": "item-not-found"
"message": "Could not find an item with the ID: {item_id}"
Invalid item ID400"code": "invalid-item-id"
"message": "Not a valid item ID: <ITEM_ID>"
Invalid site ID400"code": "invalid-site-id"
"message": "Not a valid site id : <site_id>"
Sitelink not defined for item404"code": "sitelink-not-defined"
"message": "No sitelink found for the ID: {item_id} for the site {site_id}"
Invalid edit tag400{ "code": "invalid-edit-tag", "message": "Invalid MediaWiki tag: {tag}" }
Comment too long400{"code": "comment-too-long", "message": "Comment must not be longer than {limit} characters"}

Notes:

  • "Automated edit summary" related to the edit to be of form: /* wbsetsitelink-remove:1|SITE_ID */ TITLE
  • Client can provide additional edit metadata: mediawiki tags, edit summary text to append to the automated summary, and a bot edit flag, like in DELETE /entities/items/{item_id}/statements/{statement_id}
  • Allow empty request body.
  • Handle HTTP conditional request headers as in DELETE /entities/item/{item_id}/statements/{statement_id}
  • Handle user authentication/authorization like in DELETE /entities/items/{item_id}/statements/{statement_id}

Task breakdown notes:

  • Add the new route to OAS.
  • happy path (with empty edit summary)
    • ETag and Last-Modified headers are not needed
  • Implement use case validation and deserialization
  • Add the "remove sitelink" edit summary
  • Respond 404/409 if item not found/redirect or item does not have a sitelink for the requested site ID
  • Authorization
  • Use the usual middlewares and add the route handler to RouteHandlersTest
  • Add spec tests.
  • Mark as production ready.

Event Timeline

Restricted Application added a subscriber: Aklapper. ยท View Herald TranscriptAug 22 2023, 12:48 PM
Silvan_WMDE renamed this task from Remove a sitelink for a given wiki to โ›“๏ธโ€๐Ÿ’ฅ Remove a sitelink for a given wiki.Jan 9 2024, 2:34 PM

I get "The request method (DELETE) was not one of the allowed methods for this path (HEAD, GET)", I'm not sure if I'm the one doing something wrong? (and what it is)