I’m doing something similar to grab a random image from wikimedia. (source code)… my main gripe about the Wikimedia APIs is that different endpoints/resources/whatever return drastically different data and it’s easy to break your existing code playing in their API Sandbox.
Weekend project to learn how to query APIs in JS and see if I can get what I want out of Wikidata. For a project I’m working on it would be nice to be able to put in arbitrary terms like “rock” or “Obama” or “grasshopper” and get an image back. Years ago people used to use the shut-down Google Image Search API for this, but Wikidata is nonprofit, will probably be around for a while, and arguably returns slightly better curated results, when it has them. So far it seems probably usable for my purposes. I thought I’d throw up a little web demo of the results so far. You can enter a word in one of several languages and (maybe) get an image back.
There’s code at the end but this is the first thing I’ve actually written in JS so it may or may not be any good. It does seem to work in both Firefox and Chrome at least.