Installing Wikibase as both a repo and a client on the same wiki, and using local sitelinks makes it impossible to get Wikibase item by using the sitelink string via MW API.
For example, in OSM wiki, which is both a client and a wikibase repo, each item has a sitelink:
Q104 -> Key:bridge:movable. Note that the sitelink is shown at the top right corner using a CSS hack. The site name is wiki.
A very common operation is to get the item by knowing the Key:bridge:movable string. A user can navigate to it with the Special:ItemByTitle/wiki/Key:highway. Lua code can get it with mw.wikibase.getEntityIdForTitle( 'Key:bridge:movable' ). But there seems to be no clean way to do that via MW API, which seems like a big omission.
Some (bad) workarounds:
- Use internal scribunto API module: {action: 'scribunto-console', format: 'json', title: 'Module:Sandbox', question: "=mw.wikibase.getEntityIdForTitle( 'Key:bridge:movable' )"} - try it. This is bad because it is not cachable, and because being internal, it could change at any moment.
- Create a dedicated protected Lua module, and use action=parse to call it