API talk:Info

About this board

"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"
Yamaha5 (talkcontribs)

I want to check a page protection status so I get it shows protection but it doesn't show it has Pending changes protection how can i get Pending_changes protection's information?

RobinHood70 (talkcontribs)

Just add |flagged to your prop= request:

If the page isn't flagged for revisions, you won't have a "flagged" entry in the response:

Reply to "Pending changes"
There are no older topics