As a tool developer I want to be able to replace data of a statement on a property so that my tool can store modifications made by its users
PUT /entities/properties/{property_id}/statements/{statement_id}
PUT /statements/{statement_id}
Notes
- "Automated edit summary" related to the edit to be of form: /* wbsetclaim-update:1||1 */ [[Property:P123]]: VALUE_FORMATTED (exactly the same thing as for statement on items)
- Handle HTTP conditional request headers as in PUT /entities/items/{item_id}/statements/{statement_id}
- Handle user authentication/authorization like in PUT /entities/items/{item_id}/statements/{statement_id}
- The functionality already exist for statements on items: https://doc.wikimedia.org/Wikibase/master/js/rest-api/#operations-statements-put_entities_items__item_id__statements__statement_id_
- client can provide additional edit metadata: mediawiki tags, edit summary text to append to the automated summary, and a bot edit flag, like in PUT /entities/items/{item_id}/statements/{statement_id}
Error cases to consider
HTTP response code | response payload | |
---|---|---|
Property does not exist - the "statement subject" property | 404 | "code": "property-not-found" "message": "Could not find a property with the ID: {property_id}" |
Statement does not exist | 404 | "code": "statement-not-found" "message": "Could not find a statement with the ID: {statement_id}" |
Invalid statement ID | 400 | "code": "invalid-statement-id" "message": "Not a valid statement ID: {statement_id}" |
Invalid property ID - the "statement subject" property | 400 | "code": "invalid-property-id" "message": "Not a valid property ID: {property_id}" "context": {"property-id": "{property-id}"} |
Invalid edit tag | 400 | "code": "invalid-edit-tag" "message": "Invalid MediaWiki tag: {tag}" |
Edit comment/summary too long | 400 | "code": "comment-too-long" "message": "Comment must not be longer than {limit} characters" |
Data of a statement missing mandatory field | 400 | "code": "statement-data-missing-field" "message": "Mandatory field missing in the statement data: '{field}'" "context": { "path": "{field}"} |
Value provided in statement data is invalid, incl the case when the property used is a well-formed ID but this property does not exist | 400 | "code": "statement-data-invalid-field" "message": "Invalid input for '{field}'" "context": { "path": "{field}", "value": "{value}"} |
Request would change the ID of the statement | 400 | "code": "invalid-operation-change-statement-id" "message": "Cannot change the ID of the existing statement" |
Request would change the property (predicate) of the statement | 400 | "code": "invalid-operation-change-property-of-statement" "message": "Cannot change the property of the existing statement" |
Request payload is not JSON | 415 | "code": "unsupported-content-type" "message": "Unsupported Content-Type: '{content_type}'" |
Possibly relevant pointers:
- Suggestion in 2020 Wikibase REST API proposal: https://wmde.github.io/wikibase-rest-api-proposal/#/statements/put_statements__statement_id_
- How Wikibase Action API handles this: https://www.wikidata.org/w/api.php?action=help&modules=wbsetclaim