Hello,
This is an announcement about an upcoming breaking change related to the list=wbsubscribers API Query module, which has inconsistencies in its response.
Currently, calling the action=query&list=wbsubscribers API endpoint on a Wikibase returns a response with two different keys that could potentially contain results: subscribers and wbsubscribers. In addition, the XML response format is not structured as expected.
We have identified the root cause of this issue, which was a typo in the code that sets up the API module. We have fixed the issue and made the necessary changes to ensure that the results are now added to only one key, namely wbsubscribers instead of subscribers, and in the correct XML structure. The fix is already deployed on Test Wikidata, and we plan to deploy it to Wikidata on or after 2023-05-18.
Currently, an example API response may look like this:
JSON format
XML format
{
"batchcomplete": true,
"query": {
"wbsubscribers": {},
"subscribers": {
"Q42": {
"subscribers": [
{
"site": "enwiki"
}
]
}
}
}
}
<?xml version="1.0"?>
<api batchcomplete="">
<query>
<wbsubscribers />
<subscribers>
<Q42>
<subscribers>
<subscriber site="enwiki" />
</subscribers>
</Q42>
</subscribers>
</query>
</api>
With the change, it will instead look like this:
JSON format
XML format
{
"batchcomplete": true,
"query": {
"wbsubscribers": {
"Q42": {
"subscribers": [
{
"site": "enwiki"
}
]
}
}
}
}
<?xml version="1.0"?>
<api batchcomplete="">
<query>
<wbsubscribers>
<entity id="Q42">
<subscribers>
<subscriber site="enwiki" />
</subscribers>
</entity>
</wbsubscribers>
</query>
</api>
As an API user, you can prepare for this change by first checking if the wbsubscribers element in the response is empty or not. If it is nonempty, use it (the response is using the new format); if it is empty, fall back to using the subscribers element instead (it is still using the old format). This way, your code will work both before and after the change is deployed. (Later, you can remove the fallback code.)
If you have any questions or concerns about this change, please don’t hesitate to reach out to us in this ticket (phab:T300458 https://phabricator.wikimedia.org/T300458).
Cheers,
wikidata-tech@lists.wikimedia.org