Community Wishlist Survey 2023/Miscellaneous/Wikipedia API: Output also in text or in TSV format

From Meta, a Wikimedia project coordination wiki

Wikipedia API: Output also in text or in TSV format

  • Problem: The output of the API is not in a simple format like plain text, but in JSON or HTML, where it is e.g. appropriate or requested (user request or according to API usage statistics).
  • Proposed solution: For example, enable this output, but via an API:
# List of revisions for user Dušan Kreheľ?
curl -s 'https://meta.wikimedia.org/w/index.php?title=User:Du%C5%A1an_Krehe%C4%BE&offset=&limit=500&action=history'|tr '"' "\n"|grep "oldid="|grep -v ";diff"|tr "=" " "|awk '{print $3}'|sort
21442049
21474908
21618555
21696280
22094013
22159891
22232863
22444821
22462733
23450518
23462853

Discussion

No please, JSON or XML is standard language to work with APIs. --Frettie (talk) 18:23, 10 February 2023 (UTC)[reply]

Moreover, there are plenty of command-line tools for massaging JSON data (and to a lesser extent, XML as well):
I can sympathise with wanting TSV output (it's far and away the easiest data format to parse and wrangle). It should be trivial to generate TSV output using the aforementioned tools; JQ sports a dedicated option for generating TSV-formatted output. Alhadis (talk) 19:10, 11 February 2023 (UTC)[reply]

Note that historically, the API supported a text format: txt. It was removed as it was useless: instead of a sensible format as proposed, it instead outputted human-readable debug information. Mainframe98 talk 18:45, 10 February 2023 (UTC)[reply]

Voting