Wikipedia Viewer - Structure of Wikipedia API

i’m a beginner and i’m not so good at apis.
I’m trying to figure out with wikipedia api but i can’t; it is much more confused than weather api.
I’m trying to set it up but on the link api sandbox i got stuck.
Which action do i have to use and how can i retrive the json in order to write my function which will get the results?

1 Like

You’re not alone. The Wikimedia API is incredibly confusing and in need of much better documentation. Here are the parameters I use.


Oh, thank you so much. In weather api i got stucked but with a bit of train i understood and i figured out with it. Wiki is so confused and I am so unexpert yet.

Thank you again. I will try with this options.


i tried your options and run but i can’t retrieve any data with console.log. I don’t know why.
I think there is an error in my ajax function.

Could some one help me?
Here is my app wiki viewer

There are a few things here.

First, there is an error, the usual No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin '' is therefore not allowed access.. The easiest way to avoid it is to add origin=* to your query and it should return with that sexy object you want.

Second, there won’t be any[0], check the whole object first returned from Wikipedia and update your results variable accordingly.

Oh, and it’s a good idea to send a URL encoded string, so you should add encodeURIComponent() to your searchInput.


I found it, thank you.
Just one thing. How can i retrieve the link to attach at a href attribute?
I can’t find it?

All Wikipedia articles can be found at<article title>, so you can generate them easily with the information you have.

1 Like


i made my app but there is a very small issue :slight_smile:
It doesn’t retrieve nothing in the display div.
This is my app Twitch App

Can you find why ?

What is this URL? It’s saying the service is unavailable. You should probably stick with the official TwitchAPI.

Ok, thank you. I put that link because i had read that the official would need an api key.
Anyway, now it gets data but it retrieve all account closed. it seems strange.

May be there is an issue in my if statements.

On Postman app, if i request
I retrieve this:
“error”: “Bad Request”,
“status”: 400,
“message”: “No client id specified”

Hey, thanks your answer made my app to work!
Just wondering if you could explain why does adding origin parameter made it work?
Appreciate it

This did it! Thanks zsoltime you’re a beast!

Thanks for this! I was trying to build the GET request and getting confused by the MediaWiki docs. This post was very helpful :slight_smile:

Need help.

I can get the value of my search box input. I currently comment out any ajax request and do quick test to retrieve the search input box value with alert function. But there’s no result in the pop up box when I hit ENTER. Here is my pen.

Anyone can help me?

Thank you very much! This API is very very confused
Your explanations helped me! :smile: