As an API user, I would like to be able to access diffs between revisions of items (or properties, lexemes). Currently, the API only exposes the HTML rendition of these diffs, via the compare action:
https://www.wikidata.org/w/api.php?action=help&modules=compare
This returns HTML like this:
<tr><td colspan="2" class="diff-lineno">aliases / en / 0</td><td colspan="2" class="diff-lineno">aliases / en / 0</td></tr><tr><td colspan="2"> </td><td class="diff-marker">+</td><td class="diff-addedline"><div><ins class="diffchange diffchange-inline">PF3D7_0720400</ins></div></td></tr><tr><td colspan="2" class="diff-lineno">aliases / en / 1</td><td colspan="2" class="diff-lineno">aliases / en / 1</td></tr><tr><td class="diff-marker">-</td><td class="diff-deletedline"><div><del class="diffchange diffchange-inline">PF07_0085</del></div></td></tr> <!-- diff cache key wikidatawiki:diff:wikidiff2:1.12:old-888082520:rev-888696170:1.7.3:25:lang-en -->
It would be great to have a JSON representation of these diffs as well. Currently, I can parse the HTML to extract the information I need, but this is brittle as any change in diff rendering could potentially break my consumer.
There is already a task T56328 about this in MediaWiki, but given that there is an even stronger case for this in Wikidata, I am creating a specific ticket for it. This could potentially be implemented by a dedicated API action given the different data format.
I do not have a particular JSON format to propose: anything that is easy to produce by the underlying PHP implementation would be great to have.