Wikipedia api makes no sense for anyone else?

Been reading the wikipedia api for hours and it doesn’t make sense. I understand that you use & and some word they provide to get certain information from it and use format=json at the end of the link with the endpoint, but there are hundreds of choices and I can’t find how to get just the basic description of a page and an image for it out of the hundreds of choices to make the link to get the json page. I cheated and looked at some finished wikipedia api projects and a lot of the finished projects were using words in the links that I can’t even find on the wikipedia api pages like ‘&gsrnamespace’. I know there is a namespace options but what is the gsr?
I wouldn’t be able to get this project done without this link ‘’ which I can understand easily, but I don’t have as much control as I could with all the dozens of options shown in the wikipedia api, and I still don’t fully understand how to use the wikipedia api, its too confusing.

Who else thinks the wikipedia api is hard to use?

I remember thinking the same way, I had to look at a number of examples. The information you’re looking for is in the docs but it’s not presented in a very friendly way.

Are you trying to implement exactly what the assignment asks for, or are you trying to add additional functionality? If you want to post some code, I can help you troubleshoot, since I successfully completed that assignment I should be able to help figure it out.

I want to get the information the example assignment has, plus a picture. When I cheated I saw an ajax example of how to do this, but I saw code in it that I didn’t understand like ‘&gsrnamespace’ so I don’t really want to use it unless I understand it, and I can’t find it anywhere in the wikipedia api pages. I mainly looked on the page about queries and I’ve been looking at all the different parameters for a few hours. Honestly I’m really tired of this after looking at these confusing documents for so long and since I already have a link to an api request that I can use and get the project finished, I just want to get it over with already. But if you know the specific parameters I need to get the page content and the title of the page including a main image to go with it I’ll appreciate it.

I was looking at this guys github to see how its done and he’s using parameters I don’t even see on the wikipedia api pages.

I’ll look at my project tonight and refresh my self on the api requests used, and then I’ll try to reply again.

I think the big issue here, which maybe is not quite apparent from either the FCC intro or the MediaWiki Docs right away is that, in a sense (though it can be), unlike say the Weather APP, the API is designed to do a lot more than just ‘query’. In fact MediaWiki itself is a framework much like Wordpress and is also used by many other sites.

Thus the majority of the API’s features are focused on updates, maintenance, user control, etc. Here ‘how to perform a search’ takes on less prominence in the documentation, in part I think because normally that would be something one would do from the ‘front end’ (i.e. Wiki main page).

That, in part, is also why this assignment is more challenging.

That in mind, this one section wasn’t super clear to me at first either, but in this respect the API Sandbox is useful:

To provide a few hints:

  1. Start with ‘query’ from the action drop down as that is the only request that really makes sense for our purpose-- We want to fetch some data.

  2. Once you’ve got that, hit ‘Make Request’. The first obvious question for me here is… ‘wha ? Nothing happened ?’ But here’s the thing: Once the ‘batch complete’ message comes up, select action=query from the left hand side panel and now notice you have a whole new set of sub items on the right that you have access to now that you have substantiated with ‘action=query’. Then you can make the request again.

I’m sure someone can just provide you with the straight search string, but I think it is worth taking some time to play around with the Sandbox in this way.

P.s. for each ‘action’ or ‘props’ panel, hitting ‘Expand’ below will tell you what the command does.

P.p.s. Once you are on the ‘action query’ page, before digging endlessly through the thing, scroll all the way down and from the ‘generator’ drop down choose search. That’s your core. From there on you are adding various options.

Hope that helps.

frankly i didn’t even bother much to read what they write in their api docs, something like this should be enough

i.e. you simply pass your request there instead of the stuff word like this: + “your request” + &format=json&callback=?

you shouldn’t even care about the white spaces

from that json you get the names of a bunch articles, short descriptions and you can open the page with their ids by + the page id

p.s. callback=? so it works with getjson