As a tool author I want to create new statements on an item so that changes created in my tool are stored in the Wikibase instance
As a Wikidata gadget author I want to create statements on an item so that changes made by gadget are stored back on Wikidata
Apart from statement data, mediawiki "metadata" can be specified:
* ~~"comment" to be included in the edit summary~~
* ~~use "auto summary" as the default edit summary in case no comment is provided by the user. If a comment is provided, it should be (pre- or) appended to the auto summary.~~
* "comment" metadata is not in scope for this task
* mediawiki tag(s) for the edit
* no tags should be added, if none are provided
* flag edit as made by a bot
* default: false
~~Also, to help Wikibase solve potential edit conflict, the latest revision of an item known by a client when making the request can also be provided.~~ No latest revision id should be expected (for now).
The response:
* should have the HTTP status code 201,
* should include the newly created statement in the body (including the new statement ID),
* should provide a Location header with the URL of the newly created item specific single statement,
* should include ETag and Last-Modified header fields for the item on which the statement was created.
Error scenarios:
* invalid input (400)
* this includes various scenarios with invalid values, non-existing properties, qualifiers etc in the provided statement json
* Error messages (code - message) for invalid values in the input
* incorrect statement data (not well formed JSON, non existing proprties, etc catch-all error for now): `invalid-statement-data`: "Invalid statement data provided"
* incorrect mediawiki tag: `invalid-edit-tag`: "invalid MediaWiki tag: {tag}"
* invalid value for the bot flag (if not caught by the framework - do not override the framework behaviour if already provided): `invalid-bot-flag`: "Invalid bot flag value: Must be "true" or "false" "
* item does not exist (404)
* the item is a redirect (TBD, @WMDE-leszek will check wbcreateclaim)
* unexpected error (500)
Authentication (i.e. attributing the edit to an authenticated mediawiki user) is not in scope for this task. It is tracked separately in T309846.
See also https://wmde.github.io/wikibase-rest-api-proposal/#/statements/post_entities__entity_type___entity_id__statements