Returning csv from the wikidata query api

The info is here:

It's NOT possible to append "format=csv" to the query string.

curl "" -o cats.csv

This will return the default format, xml, and who wants that these days?

To get csv, you have to send the "Accept: text/csv" header and no format param, like so, using curl for example:

curl -H "Accept: text/csv" -o cats.csv

Hope it helps.

Posted: 22 March 2021

comments powered by Disqus