How to use MediaWiki API to search for pages with a specific title and get their URL addresses

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

How to use MediaWiki API to search for pages with a specific title and get their URL addresses

Akinwale Habib


Hello team,


Hope this meets you well?


Please I am finding it impossible to generate a query to search MediaWiki API using a title and get in return url's of all matching pages.


Kindly help.


Thank you.


_______________________________________________
Mediawiki-api mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-api
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to use MediaWiki API to search for pages with a specific title and get their URL addresses

Erik Bernhardson
Unfortunately URL isn't one of the currently returned field in the search API. Currently you can simply append the returned title to the /wiki/ prefix of the same domain to generate a URL.  The basic API is:


I'll add a ticket later to make an optional parameter to return the fully qualified URL. Being explicit couldn't be bad.


On Jan 9, 2017 6:18 AM, "Akinwale Habib" <[hidden email]> wrote:


Hello team,


Hope this meets you well?


Please I am finding it impossible to generate a query to search MediaWiki API using a title and get in return url's of all matching pages.


Kindly help.


Thank you.


_______________________________________________
Mediawiki-api mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-api


_______________________________________________
Mediawiki-api mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-api
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to use MediaWiki API to search for pages with a specific title and get their URL addresses

Alex Monk
You can't just simply append /wiki/ because it might not be the article path for the wiki you're on. The default is usually {$wgScriptPath}/$1, not /wiki/$1. You can find the article path by getting api.php?action=query&meta=siteinfo&siprop=general - you'll need to replace the $1 with the article's name and prepend the server hostname.

On 9 January 2017 at 15:43, Erik Bernhardson <[hidden email]> wrote:
Unfortunately URL isn't one of the currently returned field in the search API. Currently you can simply append the returned title to the /wiki/ prefix of the same domain to generate a URL.  The basic API is:


I'll add a ticket later to make an optional parameter to return the fully qualified URL. Being explicit couldn't be bad.


On Jan 9, 2017 6:18 AM, "Akinwale Habib" <[hidden email]> wrote:


Hello team,


Hope this meets you well?


Please I am finding it impossible to generate a query to search MediaWiki API using a title and get in return url's of all matching pages.


Kindly help.


Thank you.


_______________________________________________
Mediawiki-api mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-api


_______________________________________________
Mediawiki-api mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-api



_______________________________________________
Mediawiki-api mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-api
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to use MediaWiki API to search for pages with a specific title and get their URL addresses

Gergo Tisza
In reply to this post by Erik Bernhardson
On Mon, Jan 9, 2017 at 7:43 AM, Erik Bernhardson <[hidden email]> wrote:
Unfortunately URL isn't one of the currently returned field in the search API. Currently you can simply append the returned title to the /wiki/ prefix of the same domain to generate a URL.  The basic API is:


I'll add a ticket later to make an optional parameter to return the fully qualified URL. Being explicit couldn't be bad.

You can get the URL via generators, at the cost of not getting the snippet and other search-specific data:


_______________________________________________
Mediawiki-api mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-api
Loading...