**Description**
PUT entities/items/{item_id}/sitelinks/{wiki_id}
Request payload:
```
{
"sitelink": {
"title": ...,
"badges": [ Q-ID, ... ] (optional)
},
"comment": ... (optional)
"tags": [ ... ] (optional)
"bot": false (optional)
}
```
**Acceptance criteria:**
- The respective successful responses should present the relevant data as a JSON object -- similar to the responses of GET /entities/items/{item_id}/sitelinks/{wiki_id}.
- If a sitelink in the given wiki didn't exist before the successful request the response should use 201 code.
- If the request changed the existing sitelink, the response code should be 200.
**Error cases to consider**
<table>
<tr>
<th>
</th>
<th>HTTP response code</th>
<th>response payload</th>
</tr>
<tr>
<td>Item does not exist </td>
<td>404</td>
<td>
`"code": "item-not-found"`
`"message": "Could not find an item with the ID: {item_id}"`
</td>
</tr>
<tr>
<td>Invalid item ID </td>
<td>400</td>
<td>
`"code": "invalid-item-id"`
`"message": "Not a valid item ID: {item_id}"`
`"context": {"item": "{item-id}"}`
</td>
</tr>
<tr>
<td>Invalid wiki ID </td>
<td>400</td>
<td>
`{ "code": "invalid-wiki-id", "message": "Not a valid wiki ID: {wiki_ID}"}`
</td>
</tr>
<tr>
<td>Invalid edit tag</td>
<td>400</td>
<td>
`{ "code": "invalid-edit-tag", "message": "Invalid MediaWiki tag: {tag}" }`
</td>
</tr>
<tr>
<td>Comment too long</td>
<td>400</td>
<td>
`{"code": "comment-too-long", "message": "Comment must not be longer than {limit} characters"}`
</td>
</tr>
<tr>
<td>title field not provided</td>
<td>400</td>
<td>TBD</td>
</tr>
<tr>
<td>title is empty</td>
<td>400</td>
<td>TBD</td>
</tr>
<tr>
<td>value provided as a badge is not an item ID</td>
<td>400</td>
<td>TBD</td>
</tr>
<tr>
<td>item provided is not allowed as a site link badge</td>
<td>400</td>
<td>TBD</td>
</tr>
<tr>
<td>value of badges field is not a list</td>
<td>400</td>
<td>TBD</td>
</tr>
</table>
**Notes**
- Automated edit summaries to be of the form:
- if the edit resulted in adding a site link to a wiki which was not connected before, and no badges: `/* wbsetsitelink-add:1|WIKI_ID */ TITLE`
- if the edit resulted in adding a site link to a wiki which was not connected before, and there are badges: `/* wbsetsitelink-add-both:2|WIKI_ID */ TITLE, BADGE_ITEMS_FORMATTED`
- if the edit resulted in setting a title to a different page on a wiki which has been connected as a site link before, and there are no badges: `/* wbsetsitelink-set:1|WIKI_ID */ TITLE`
- if the edit resulted in setting a title to a different page on a wiki which has been connected as a site link before, and there are badges: `/* wbsetsitelink-set-both:2|WIKI_ID */ TITLE, BADGE_ITEMS_FORMATTED`
- if the edit resulted in changes badges of an existing sitelink (and not change the title): `/* wbsetsitelink-set-badges:1|WIKI_ID */ BADGE_ITEMS_FORMATTED`
- where BADGE_ITEMS_FORMATTED is a comma-separated list of wikitext links to item pages
- see `Wikibase\Repo\ChangeOp\ChangeOpSiteLink` class, and surrounding classes, for further details of the existing Wikibase automated edit summary logic
- client can provide additional edit metadata: mediawiki tags, edit summary text to append to the automated summary, and a bot edit flag, like in GET /entities/items/{item_id}/labels/{language_code}
- Handle HTTP conditional request headers as in PUT /entities/items/{item_id}/statements (double check!)
- Handle user authentication/authorization like in PUT /entities/items/{item_id}/statements
**Additional notes:**
How Action API handles it: https://www.wikidata.org/w/api.php?action=help&modules=wbsetsitelink