PUT /entities/items/{item_id}/labels/{language_code}
PUT /entities/items/{item_id}/description/{language_code}
Request Payload (label)
{ label: LABEL-TEXT (optional) comment: Edit comment (optional) tags: Edit tags (array/list) (optional) bot: true/false }
Request Payload (description)
{ description: DESCRIPTION-TEXT (optional) comment: Edit comment (optional) tags: Edit tags (array/list) (optional) bot: true/false }
The respective successful responses should present the relevant data as a string -- similar to the responses of GET /entities/items/{item_id}/labels/{language_code}, and GET /entities/items/{item_id}/descriptions/{language_code} respectively.
If a label or a description in the given language didn't exist before the successful request the response should use 201 code. If the request changed the existing label or description, the response code should be 200.
The automated summaries for the edits made should be generated as described:
- if the label in the given language is created (has not been defined before the API request): /* wbsetlabel-add:1|{language_code} */ LABEL-TEXT
- if the label in the given language is replaced/updated (has been defined before the API request): /* wbsetlabel-set:1|{language_code} */ LABEL-TEXT
- if the description in the given language is created (has not been defined before the API request): /* wbsetdescription-add:1|{language_code} */ DESCRIPTION-TEXT
- if the description in the given language is replaced/updated (has been defined before the API request): /* wbsetdescription-set:1|{language_code} */ DESCRIPTION-TEXT
Error cases to consider:
- if {item_id} does not exist, the API should generate a 404 response { "code": "item-not-found", "message": "Could not find an item with the ID: {item_id}" }
- if {item_id} is not a valid item ID, the API should generate a 400 response { "code": "invalid-item-id", "message": "Not a valid item ID: {item_id}"}
- if {language_code} is not a valid language code, the API should generate a 400 response { "code": "invalid-language-code", "message": "Not a valid language code: {language_code}"}
- if {item_id} is a redirect, the API should generate a 409 response { "code": "redirected-item", "message": "Item {item_id} has been merged into {other_id}." }
- if the provided label/description is invalid (in the sense of Wikibase label/description validation logic) the API should generated 400 response, containing, depending on the error
- label/description empty
{ "code": "label-empty", "message": "Label must not be empty", }
- label/description too long
{ "code": "label-too-long", "message": "Label must be no more than {limit} characters long", "context": { "value": {label}, "character-limit": {limit} } }
- if the edit results in creating a an item which has the exact same label and description in a given language, the edit should be prevent with error response: { "code": "label-description-same-value", "message": "Label and description for language code {language} can not have the same value.", "context": "language": {language} }
- if the edit results in creating a an item which has the same label and description in a given language as an existing item, the edit should be prevented with error response: {"code":"item-label-description-duplicate", "message": "Item {dupe_id{ already has label "{label}" associated with language code {language}, using the same description text.}", "context": { "language": {language}, "label": {label}, "description": {description}. "matching-item-id": {dupe_item_id} }
- other label or description validation error: { "code": "invalid-label, "message": "Not a valid label: {label-text}." }, or { "code": "invalid-description, "message": "Not a valid description: {description-text}." }
- If an invalid Mediawiki edit tag is provided, the API should generate a 400 response { "code": "invalid-edit-tag", "message": "Invalid MediaWiki tag: {tag}"}
- If a value for bot parameter other than true or falseis provided, Mediawiki REST API framework's error is to be used
Note:
- mul is a valid language code for a label but it is not allowed for descriptions