Wikimedia API Sandbox

Has anyone figured out how to use this sandbox for Wikimedia’s API. The API’s main page has a tutorial video, but it’s from 2012 (link below). The sandbox seems to have changed quite a bit since then, so the tutorial is rather useless. The version the instructors are using in the video seems pretty intuitive and easy to use, but this newer version doesn’t seem to have any useful features (almost no features really). Am I missing something here? I can’t even change the title of the Wikipedia article in the sandbox for crying out loud.

You’re not alone. I’ve never been a fan of the Wikimedia API, and every time I’ve used it I felt like my head had been turned around backwards. I don’t have any advice for you, and frankly I don’t think it’s worth your time to bang your head against their “documentation”. The query I used has been posted elsewhere on the forum, but I’ll repost it here in some spoiler tags in case you just want to copy it and get on with the project. You may have to make slight modifications depending on how you’re making your AJAX calls.

`https://en.wikipedia.org/w/api.php?action=query&list=search&srsearch=${searchTerm}&utf8&format=json`

The important bits:

  • action=query
  • list=search
  • srsearch=${yourSearchTermHere}
1 Like

the wikipedia api sandbox is pretty good - you do have to wade through scattered api doc pages to understand how the api and the sandbox works - in a nutshell the sandbox is a query builder - each selection in the left panel shows the valid parameters in the right panel for the selection - any previous set of parameters disappears which is somewhat disconcerting - keep repeating this pair of actions to build the query on the left

e.g. to search “music” you do this in order

left panel                         right panel

1. select main
                                   2. set action -> query
3. select action=query
                                   4. set list -> search

5. select list=search
                                   6. enter srsearch -> music

this builds this query

/w/api.php?action=query&format=json&list=search&srsearch=music

Now click Make Request to send the query

you’re right about the gui change since the video - I think the interface has improved - just needs a newer video or guide

pm me if you or anyone else is interested in a live wikipedia api tutorial session

2 Likes

Thanks for the responses. I just figured something out today; the items in the left panel are clickable. I didn’t realize these were links that lead to other menu options. Now I see all of the features that I thought should have been there in the first place. It’s a shame the instructions on the sandbox page are so scant.