POST /entities/items/{item_id}/aliases/{language_code}
request payload
{ "aliases": [ "ALIAS_TEXT", ... ] ... }
Acceptance criteria:
- The respective successful responses should present the list of aliases in a given language -- similar to the responses of GET /entities/items/{item_id}/aliases/{language_code}.
- If there was no aliases in the given language before the successful request the response should use 201 code, otherwise 200.- input alias is "appended" to the aliases list in a given language
Error cases to consider
HTTP response code | response payload | |
---|---|---|
Invalid item ID | 400 | "code": "invalid-item-id" "message": "Not a valid item ID: {item_id}" "context": { "item": "{item-id}" } |
Invalid language code | 400 | "code": "invalid-language-code" "message": "Not a valid language code: {language_code}" |
Alias is empty | 400 | "code": "alias-empty" "message": "Alias must not be empty" |
Alias list is empty | 400 | "code": "alias-list-empty" "message": "Alias list must not be empty" |
Alias too long | 400 | "code": "alias-too-long" "message": "Alias must be no more than {limit} characters long" "context": { "value": "{alias}", "character-limit": "{limit}" } |
Alias contains invalid characters | 400 | "code": "invalid-alias" "message": "Not a valid alias: '{alias}'" "context": { "alias": "{alias}" } |
Alias duplicate | 400 | "code": "duplicate-alias" "message": "Alias list contains a duplicate alias: '{alias}'" "context": { "alias": "{alias}" } |
Invalid edit tag | 400 | "code": "invalid-edit-tag" "message": "Invalid MediaWiki tag: {tag}" |
Comment too long | 400 | "code": "comment-too-long" "message": "Comment must not be longer than {limit} characters" |
Item does not exist | 404 | "code": "item-not-found" "message": "Could not find an item with the ID: {item_id}" |
Item redirect | 409 | "code": "redirected-item" "message": "Item {item_id} has been merged into {other_id}" |
Notes
- Edit summaries should be in the format: /* wbsetaliases-add:{number-of-new-aliases}|{language-code} */ {new-aliases-comma-separated}, {user-comment}
- client can provide additional edit metadata: mediawiki tags, edit summary text to append to the automated summary, and a bot edit flag, like in GET /entities/items/{item_id}/alias/{language_code}
- Handle HTTP conditional request headers as in PUT /entities/items/{item_id}/(labels or descriptions) /{language_code}
- Handle user authentication/authorization like in PUT /entities/items/{item_id}/(labels or descriptions)/{language_code}
Task breakdown notes:
- Add the new route to OAS.
- happy path (with empty edit summary)
- directly use the AliasesDeserializer for deserialization
- ETag and Last-Modified
- include difference between 200 OK and 201 CREATED cases
- Create use case validation/deserialization
- Create edit summary
- Respond 404/409 if item not found/redirect
- Authorization
- Use the usual middlewares and add the route handler to RouteHandlersTest
- Add spec tests.
- Mark as production ready.