Ash Reddy
Ash Reddy

Reputation: 1052

How to get date of creation of Wikipedia page by API?

Wikipedia article United States presidential election, 2016 has page information which contains "Date of page creation" under "Edit history" section. How do I get this date through an API?

Upvotes: 2

Views: 3152

Answers (1)

Termininja
Termininja

Reputation: 7036

For this goal you need to use action query with property revisions:

https://en.wikipedia.org/w/api.php?action=query&prop=revisions&rvlimit=1&rvprop=timestamp&rvdir=newer&titles=United States presidential election, 2016

where:

  • rvdir=newer - sort revisions by oldest first
  • rvlimit=1 - get only one revision (the 1st one)
  • rvprop=timestamp - get only information about the revision timestamp

In your case the result will be: "2009-02-03T09:59:37Z"09:59, 3 February 2009.

Upvotes: 7

Related Questions