Last modified: 2013-07-17 15:51:56 UTC
I am using the Wiki API for accessing the entire Wiki. When I am calling the following API; http://en.wikipedia.org/w/api.php?action=expandtemplates&format=json&text={{POTD/{{#time:Y-m-d}}|title}} I get the following output; { "expandtemplates": { "*": "''[[A Wheat Field with Cypresses]]''" } } which I use in the next API as follows to get the actual image for this title. http://en.wikipedia.org/w/api.php?action=query&prop=pageimages&piprop=thumbnail|name&pithumbsize=240&format=json&redirects=&titles=A%20Wheat%20Field%20with%20Cypresses But it seems the title contains an additional "A" because of which it gives me missing element. { "query": { "pages": { "-1": { "ns": 0, "title": "A Wheat Field with Cypresses", "missing": "" } } } } But if I remove "A" from the title it gives me proper details as follows; { "query": { "pages": { "27773473": { "pageid": 27773473, "ns": 0, "title": "Wheat Field with Cypresses", "thumbnail": { "source": "https://upload.wikimedia.org/wikipedia/commons/thumb/7/7d/Vincent_Willem_van_Gogh_049.jpg/240px-Vincent_Willem_van_Gogh_049.jpg", "width": 240, "height": 191 }, "pageimage": "Vincent_Willem_van_Gogh_049.jpg" } } } } This is breaking my Web App which I am developing as the title returned by API is incorrect. Please let me know if this is an actual bug or the title entered is incorrect or I am making a mistake somewhere. Thanks and Regards, Harin
The "title" field in https://en.wikipedia.org/wiki/Template:POTD/2013-07-17 is not correct. This has nothing to do with the API or MediaWiki. Also, BTW, if you want the image why are you not fetching https://en.wikipedia.org/w/api.php?action=expandtemplates&format=json&text={{POTD/{{%23time:Y-m-d}}|image}} ?