Hi guys,
I am trying to retrieve the templates associated to a page: http://en.wikipedia.org/w/api.php?action=query&prop=templates&format...
So in this scenario, I am able to get a list, but I noticed some of the listed templates here are marked as protected. I am not able to see any attribute in the results that shows this flag.
Any ideas on how can I filter those out?
Thanks, Chux
On Fri, May 3, 2013 at 2:04 AM, Chux chux18@gmail.com wrote:
I am trying to retrieve the templates associated to a page: http://en.wikipedia.org/w/api.php?action=query&prop=templates&format...
So in this scenario, I am able to get a list, but I noticed some of the listed templates here are marked as protected. I am not able to see any attribute in the results that shows this flag.
Any ideas on how can I filter those out?
There is no way to filter them out such that they aren't returned from the query. But you can easily enough retrieve the protection information for each of the returned templates by using templates as a generator, so you can filter them out on the client side:
http://en.wikipedia.org/w/api.php?action=query&generator=templates&f...
You can use prop=templates as a generator and then ask for prop=info&inprop=protection to get the protection information about each template:
http://en.wikipedia.org/w/api.php?format=json&action=query&pageids=1...
Petr Onderka [[en:User:Svick]]
On Fri, May 3, 2013 at 8:04 AM, Chux chux18@gmail.com wrote:
Hi guys,
I am trying to retrieve the templates associated to a page: http://en.wikipedia.org/w/api.php?action=query&prop=templates&format...
So in this scenario, I am able to get a list, but I noticed some of the listed templates here are marked as protected. I am not able to see any attribute in the results that shows this flag.
Any ideas on how can I filter those out?
Thanks, Chux
Mediawiki-api mailing list Mediawiki-api@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-api
mediawiki-api@lists.wikimedia.org