API talk:Backlinks

Is there no way, using the API, to get backlinks for a non-existent page? This functionality exists using the Special:WhatLinksHere feature [1] and would be useful for programatically fixing broken links. /Lokal Profil (talk) 10:52, 4 November 2013 (UTC)Reply

Is there any way to include transcluding pages among those who link the template? Soshial (talk) 22:36, 5 November 2013 (UTC)Reply

edit

Wikiget

edit

Compared with API:Linkshere

edit

My understanding is that the other API is available under a lower MW version, since they all claimed to be able to be used as generators. Is that true? --CXuesong (talk) 07:35, 23 September 2017 (UTC)Reply

Seconding this question. What is the semantic difference between this list module and API:Linkshere? It seems both have features the other one does not have, but what is the reason for having two modules that effectively solve the same task? --78.50.153.140 13:43, 11 November 2018 (UTC)Reply

Odd query result (blredirect in Backlinks) ?

edit

I'm not understanding the redirlinks part in the query result below. It looks to me like its telling me that the page "Forestry" is linking to the "File:Hafen-Forestry.png" image trough the "File:Forestry.png" redirect. Which can't be the case. But if it is, should it not also show a "Skills" pages there.
I can't make sense of this ???
MediaWiki: 1.31.0
WhatLinksHere/File:Hafen-Forestry.png ... Also see "File usage" part at File:Hafen-Forestry.png page itself.
Links used details:

  • "Skill" page uses a normal/direct file: link to the "File:Forestry.png" redirect.
  • The "Forestry" page however uses an automated(template) link to the "File:Hafen-Forestry.png" page. (The template also uses #ifexist on the "File:Forestry.png" page in this case, but that should not matter here (as it only triggers an add-to-category action)

query used:

{
	"action": "query",
	"format": "json",
	"list": "backlinks",
	"formatversion": "2",
	"bltitle": "File:Hafen-Forestry.png",
	"blredirect": 1
}


Output I get:

{
    "batchcomplete": true,
    "query": {
        "backlinks": [
            {
                "pageid": 9423,
                "ns": 0,
                "title": "Forestry"
            },
            {
                "pageid": 13595,
                "ns": 6,
                "title": "File:Forestry.png",
                "redirect": true,
                "redirlinks": [
                    {
                        "pageid": 9423,
                        "ns": 0,
                        "title": "Forestry"
                    }
                ]
            }
        ]
    }
}

Related API Sandbox link.
--MvGulik (talk) 06:30, 31 July 2019 (UTC)Reply

Do not confuse backlinks with Api:imageusage. Also, #ifexist causes the image to be counted as a backlink, hence why it appears in the results. --Ciencia Al Poder (talk) 09:34, 31 July 2019 (UTC)Reply
Currently imageusage was not part of the test setup, will add it and check its doc and behaviour and compare.
> "#ifexist causes the image to be counted as a backlink, hence why it appears in the results"
Should the redirlinks part than not also show a "Skills" page ? --MvGulik (talk) 15:59, 31 July 2019 (UTC)Reply
...
Right ... After some testing (not much to read up on on the related doc pages I'm afraid, there almost virtual identical) it game back to me. Imageusage is of limited use because it will not return 'any' redirect related information, and Backlinks ignores file(display):links. Guess both Forestry cases in backlinks result are #ifexist related. Time to dig into my old codes so see what I did in relation to this ... if anything. --MvGulik (talk) 19:54, 31 July 2019 (UTC)Reply
Return to "Backlinks" page.