Topic on API talk:Info

"redirect" in result

3
Vаdiм (talkcontribs)

I do not seem to be able to get anything in redirect field in a query result. For example this query to the Wikivoyage returns:

 {
    "batchcomplete": "",
    "query": {
        "pages": {
            "32897": {
                "pageid": 32897,
                "ns": 0,
                "title": "Siracusa",
                "contentmodel": "wikitext",
                "pagelanguage": "en",
                "pagelanguagehtmlcode": "en",
                "pagelanguagedir": "ltr",
                "touched": "2017-04-12T09:57:53Z",
                "lastrevid": 1337310,
                "length": 30,
                "redirect": ""
            }
        }
    }
}

so the redirect field is empty, while Siracusa page is a redirect.

RobinHood70 (talkcontribs)

The redirect field is a boolean. If it's present, that means it's true; if it's absent, it's false. Alternatively, if you're using MediaWiki 1.25 or above, you can add <code>&formatversion=2</code> to your query, and it will give you an explicit true/false boolean with all results.

Vаdiм (talkcontribs)

Thanks for making it clear!

Reply to ""redirect" in result"