11

When I call wiki APIs for accessing image URLs, I get image URLs like this,

File:Ad-tech London 2010 (2).JPG

How to get the correct URL of this file from wiki API?

Termininja
  • 6,620
  • 12
  • 48
  • 49
Anu
  • 111
  • 1
  • 1
  • 5
  • Which is the API query you used that returned said "URL"? You might be able to use the current module as a generator and get imageinfo [within the same query](http://stackoverflow.com/a/30779503/2683737). – Rainer Rillke Jul 05 '15 at 13:12

2 Answers2

14

There's little documentation on image/thumbnail URLs besides T153497. You can use Special:FilePath and/or thumb.php:

simon04
  • 3,054
  • 29
  • 25
  • Thanks for that. There is a bit of a documentation that I could find once you gave the direction: https://www.mediawiki.org/wiki/Help:Linking_to_files#Direct_links_from_external_sites – arkhi Aug 17 '22 at 18:02
11

You can get the proper URLs from an imageinfo query like this:

https://en.wikipedia.org/w/api.php?action=query&titles=File:Test.jpg&prop=imageinfo&iilimit=50&iiend=2007-12-31T23:59:59Z&iiprop=timestamp|user|url

More info at MediaWiki API Help.

technomage
  • 9,861
  • 2
  • 26
  • 40
brightbyte
  • 971
  • 4
  • 10