Wikipedia:Wiki ViewStats/API

From Wikipedia
Jump to navigation Jump to search


URL Parameters[edit source]

base url:     https://tools.wmflabs.org/wikiviewstats/index.php


parameter impact possible values short example(s) default version
page page title
  • page title without or
  • with wildcards
  • page=Neuromancer
  • page=User:Jack*
  • page=list*episodes*
-none- 0.92
lang wiki language
  • country code as per ISO 639 or
  • commons
  • m (Mediawiki)
  • meta
  • incubator
  • sources
  • outreach
  • species or
  • * for all wikis
  • lang=en
  • lang=commons
  • lang=*
your browsers default language 0.92
project
or
wiki
wiki
  • or wikipedia
  • b or wikibooks
  • d or wiktionary
  • n or wikinews
  • q or wikiquote
  • s or wikisource
  • v or wikiversity
  • voy or wikivoyage
  • * (all)
  • project=d
  • project=%
  • wiki=wiktionary
  • wiki=*
wikipedia 0.92 / 0.99 (alternative parameter name + values)
latest 1 query period in past days
  • 30
  • 60
  • 90
  • 180
  • latest=30
30 0.92
datefrom 1 query start date
  • 0000-00-00 (today)
  • 2013-xx-00 (xx = dedicated month)
  • 2013-xx-yy (custom: any valid date)
  • datefrom=0000-00-00
  • datefrom=2013-10-00
  • datefrom=2013-06-14
automatically calculated 0.1
dateto 1 query end date
  • 2013-xx-yy (custom: any valid date)
  • dateto=2013-08-23
automatically calculated 0.1
type 2 TOP-lists, HOT today
  • world (all pages)
  • user (users)
  • discussion (talks, discussions)
  • portal (portals)
  • project (project pages)
  • comfile (commons & file)
  • special (special pages)
  • help (help pages)
  • thanks
  • type=user
  • type=world&datefrom=2013-08-00
  • type=thanks
-none- 0.1 / thanks 0.98
locale 3 GUI language
  • en
  • de
  • fr
  • es
  • it
  • nl
  • pl
  • ru
  • sv
  • zh
  • ja
  • locale=es
your browsers default language 0.1
favurl 4 URL of wiki page where your favorites are located
  • valid url of wiki (user) page
  • favurl=https://en.wikipedia.org/wiki/User:Jack
-none- 0.95
section 5 Page section where favorites are located
  • Section header
  • section=My_articles
-none- 0.95
(1) 
You can either specify latest OR datefrom (dedicated month) OR datefrom + dateto (custom). If you specify all of them - Uhm, you will see what you get.
(2) 
In combination with datefrom≔0000-00-00 (today) OR datefrom≔2013-xx-00 (dedicated month). If datefrom is omitted datefrom≔0000-00-00 (today) is set automatically
(3) 
Your preferred language not yet there? Feel free to act! Leave a message.
(4) 
Only in combination with parameter section. See help for impact of this parameter
(5) 
Only in combination with parameter favurl


Examples[edit source]

Query string and parameters follow the rules of RFC 1738 and RFC 3986. The first parameter ist attached to base url with "?" sign, further parameters are attached with "&" sign.

base url:     https://tools.wmflabs.org/wikiviewstats/index.php

base url + query string result
https://tools.wmflabs.org/wikiviewstats/index.php?page=Star_Trek hits of page title "Star Trek" (30 days)
https://tools.wmflabs.org/wikiviewstats/index.php?page=Avatar_(película)&lang=es hits of "Avatar (film)" in spanisch wikipedia (30 days)
https://tools.wmflabs.org/wikiviewstats/index.php?page=word&lang=ru&project=d hits of "word" in russian wiktionary (30 days)
https://tools.wmflabs.org/wikiviewstats/index.php?type=world&lang=zh&project=% top list of all pages in all chinese (zh) wikis (today)
↓ for subsequent examples baseurl is not shown (you can click the link anyway)
?favurl=https://de.wikipedia.org/wiki/Benutzer:Hedonil&section=Agenda hits of user hedonil's articles (30 days)


RESTful syntax & internal links[edit source]

Alternatively it's possible to make an invocation using RESTful URI syntax – also known as "clean" URI-syntax[1]

As of version 0.99 there are 2 alternatives:

type RESTful URI syntax internal wiki link
1. full https://tools.wmflabs.org/wikiviewstats/lang.wiki/latest/page [[toollabs:wikiviewstats/de/latest30/Theodor_Fontane]]
alternatively
[[toollabs:wikiviewstats/de/30/Theodor_Fontane]]
2. short https://tools.wmflabs.org/wikiviewstats/lang.wiki/page [[toollabs:wikiviewstats/de.q/Theodor_Fontane]]
alternatively
[[toollabs:wikiviewstats/de.wikiquote/Theodor_Fontane]]
  • If a parameter is not specified, default values are set
  • With this syntax only "*" as wildcard is allowed. "%" is forbidden by specification.

References[edit source]

  1. RESTful uri design at blog.2partsmagic.com