Page MenuHomePhabricator

Discoverability of federation scenarios
Open, Needs TriagePublic

Description

tldr: As a Wikibase API user, given a Wikibase API endpoint such as https://www.wikidata.org/w/api.php or https://commons.wikimedia.org/w/api.php, I would like to be able to determine via the API if and how this Wikibase instance is federated with another one.

Why this is needed

  1. I want to retrieve data from Wikibase with wbgetentities, for instance action=wbgetentities&ids=M74698470. To make sense of the properties and values I get, I need to be able to retrieve their content. This is already possible with wbgetentities on the federating instance: https://commons.wikimedia.org/w/api.php?action=wbgetentities&ids=Q192465 returns the contents of the target item. This is all nice and transparent so far!
  1. What if I want to edit Q192465? I can try to edit it with the API, for instance with wbsetlabel. But if I do that through the Commons API, this will fail ({"error":{"code":"internal_api_error_DBQueryError","info":"[66591293-262e-4410-81d5-b35d6bf0bea2] Caught exception of type Wikimedia\\Rdbms\\DBQueryError","errorclass":"Wikimedia\\Rdbms\\DBQueryError"},"servedby":"mw1343"})
  1. I should have edited it on Wikidata instead obviously. But how do I discover that? There is nothing in https://commons.wikimedia.org/w/api.php?action=wbgetentities&ids=Q192465 that indicates that this entity actually comes from Wikidata.

What I would expect

In some API action (say a fictional action=getfederationsettings), I should be able to get some sort of description of the federation in place in the instance.

This could be inspired from the MediaWiki configuration used by the Federated Properties project, which might be more suitable for public exposure since it refers to MediaWiki endpoints (rather than federation through the database cluster).

Context

Perhaps the right place for this information could be the Automated Configuration Detection feature?

Such a discoverability would be of great help to make an OpenRefine-Commons integration in a generic way.
I wrote up a description of the issue here: https://hackmd.io/ZYWPoLrZSUSE9paRnXe7hg?view