As a tool developer I want to add statements to properties so that users of my tool can model properties in their Wikbase
POST /entities/properties/{property_id}/statements
Notes
- Request and response structures to follow what the item-related counterpart does, see https://doc.wikimedia.org/Wikibase/master/js/rest-api/#operations-statements-post_entities_items__item_id__statements
- Note the 201 response code on success and Location header in the successful creation response
- "Automated edit summary" related to the edit to be of form: /* wbsetclaim-create:1||1 */ [[Property:P123]]: VALUE_FORMATTED (exactly the same thing as for statement on items)
- Handle HTTP conditional request headers as in POST /entities/items/{item_id}/statements
- Handle user authentication/authorization like in POST /entities/items/{item_id}/statements
- client can provide additional edit metadata: mediawiki tags, edit summary text to append to the automated summary, and a bot edit flag, like in POST /entities/items/{item_id}/statements
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}" |
Invalid property ID - the "statement subject" property | 400 | "code": "invalid-property-id" "message": "Not a valid property ID: {property_id}" "context": {"property": "{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 in the statement 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 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/post_entities__entity_type___entity_id__statements
- How Wikibase Action API handles this: https://www.wikidata.org/w/api.php?action=help&modules=wbsetclaim