views:

3734

answers:

2

Hi,

I'm trying to find out if there's a wikipedia api (I Think it is related to the mediawiki?).

If so, I would like to know how I would tell wikipedia to give me an article about the new york yankees for example.

What would the REST url be for this example?

All the docs on this subject seem fairly complicated.

+3  A: 

See http://www.mediawiki.org/wiki/API

Specifically for Wikipedia API is located at http://en.wikipedia.org/w/api.php

drdaeman
yea, i cant figure out how to do my example after reading that. any ideas?
chris
Perhaps you should spend more than 5 minutes reading the documentation.
Matthew Flaschen
no, i seriously can't figure that document out. i don't know how to get specific page data using that api.
chris
drdaeman
+11  A: 

You really really need to spend some time reading the documentation, as this took me a moment to look and click on the link to fix it. :/ but out of sympathy i'll provide you a link that maybe you can learn to use.

http://en.wikipedia.org/w/api.php?action=query&prop=revisions&titles=New_York_Yankees&rvprop=timestamp|user|comment|content

That's the variabled you will be looking to get. Your best bet is to know the page you will be after and replace the Wikipedia link part into the title i.e.:

http://en.wikipedia.org/wiki/New_York_Yankees [Take the part after the wiki/]

-->

http://en.wikipedia.org/w/api.php?action=query&prop=revisions&titles=New_York_Yankees&rvprop=timestamp|user|comment|content

[Place it in the title variable of the GET request.

The URL above can do with tweaking to get the different sections you do or do not want. So read the documentation :)

Shadi Almosri
+1 for an actual example, instead of just dumping links (even though the example is also just a link... :)
Jonik
thanks for giving the example. helps!
chris