Page MenuHomePhabricator

๐Ÿ“ฎ Add a statement to a property
Closed, ResolvedPublic13 Estimated Story Points

Description

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 coderesponse payload
Property does not exist - the "statement subject" property404"code": "property-not-found"
"message": "Could not find a property with the ID: {property_id}"
Invalid property ID - the "statement subject" property400"code": "invalid-property-id"
"message": "Not a valid property ID: {property_id}"
"context": {"property": "{property-id}"}
Invalid edit tag400"code": "invalid-edit-tag"
"message": "Invalid MediaWiki tag: {tag}"
Edit comment/summary too long400"code": "comment-too-long"
"message": "Comment must not be longer than {limit} characters"
Data of a statement missing mandatory field400"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 exist400"code": "statement-data-invalid-field"
"message": "Invalid input for '{field}'"
"context": { "path": "{field}", "value": "{value}"}
Request payload is not JSON415"code": "unsupported-content-type"
"message": "Unsupported Content-Type: '{content_type}'"

Possibly relevant pointers:

Event Timeline

Restricted Application added a subscriber: Aklapper. ยท View Herald TranscriptJun 16 2023, 1:22 PM
Silvan_WMDE set the point value for this task to 13.Jun 29 2023, 10:30 AM
Jakob_WMDE renamed this task from Add a statement to a property to ๐Ÿ“ฎ Add a statement to a property.Aug 8 2023, 1:17 PM

Notes from task breakdown: