Pergunta

I can't figure out how to get them to work. According to the official API documentation:

http://www.mediawiki.org/wiki/API:Query#Resolving_redirects

it would imply that the following request:

http://en.wikipedia.org/w/api.php?action=query&titles=Hybrid%20Cars&prop=info|links&redirects

would resolve Hybrid Cars and redirect to Hybrid Vehicles page, but it does not. I.e., I expected something like:

http://en.wikipedia.org/w/api.php?action=query&titles=Hybrid%20Vehicles&prop=info|links

Foi útil?

Solução

The page Hybrid Cars does not exist, so the result you're getting (with the missing attribute) is correct. You probably meant Hybrid cars, which is a redirect to Hybrid vehicle. Page names on Wikipedia are case sensitive except for the first letter.

If you use the correct capitalization, you will get the correct results:

http://en.wikipedia.org/w/api.php?action=query&titles=Hybrid%20cars&prop=info|links&redirects

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top