Wikipedia search API: how to sort by incoming links
14:16 08 Dec 2025

I try to use the incoming_links_desc parameter to sort pages by descending incoming links but no luck.

Here is an example query.

curl -s "https://en.wikipedia.org/w/api.php?action=query&format=json&prop=pageprops&generator=search&gsrsearch=turquoise+parrot&gsrsort=incoming_links_desc" |json_pp |grep '"title"'

NB. I use generator because I need pageprops.

And the results with page link numbers (from Tools > What links here):

1112            "title" : "Corvidae"
1299            "title" : "Chameleon"
3320            "title" : "Michoacán"
848             "title" : "Tanager"
1915            "title" : "Mesa Verde National Park"
1440            "title" : "Hohokam"
281             "title" : "Characters of the Metal Gear series"
1689            "title" : "Tincture (heraldry)"
3770            "title" : "Chiapas"
1123            "title" : "Eric Cartman"

Actually the pages are sorted by page id, not incoming links. However the results are different with and without the parameter.

search wikipedia wikipedia-api