Get revision
GET | /core/v1/{project}/{language}/revision/{id}/bare
|
---|
Returns details for an individual revision.
Examples
curl
# Get information about revision 983392678 to the Earth article on English Wikipedia
$ curl https://api.wikimedia.org/core/v1/wikipedia/en/revision/983392678/bare
Python
# Python 3
# Get information about revision 983392678 to the Earth article on English Wikipedia
import requests
revision_id = '983392678'
url = 'https://api.wikimedia.org/core/v1/wikipedia/en/revision/' + revision_id + '/bare'
headers = {
'Authorization': 'Bearer YOUR_ACCESS_TOKEN',
'User-Agent': 'YOUR_APP_NAME (YOUR_EMAIL_OR_CONTACT_PAGE)'
}
response = requests.get(url, headers=headers)
data = response.json()
print(data)
PHP
<?php
// Get information about revision 983392678 to the Earth article on English Wikipedia
$revision = '983392678';
$authorization = 'Authorization: Bearer YOUR_ACCESS_TOKEN';
$endpoint = 'https://api.wikimedia.org/core/v1/wikipedia/en/revision/' . $revision . '/bare';
$ch = curl_init( $url );
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
curl_setopt( $ch, CURLOPT_HTTPHEADER, array( $authorization ));
curl_setopt( $ch, CURLOPT_USERAGENT, 'YOUR_APP_NAME (YOUR_EMAIL_OR_CONTACT_PAGE)' );
$output = curl_exec( $ch );
curl_close( $ch );
echo( $output );
?>
JavaScript
// Get information about revision 983392678 to the Earth article on English Wikipedia
let url = 'https://api.wikimedia.org/core/v1/wikipedia/en/revision/983392678/bare';
let response = await fetch( url,
{
headers: {
'Authorization': 'Bearer YOUR_ACCESS_TOKEN',
'Api-User-Agent': 'YOUR_APP_NAME (YOUR_EMAIL_OR_CONTACT_PAGE)'
}
}
);
response.json()
.then(console.log).catch(console.error);
Parameters
project
required path |
Project name. For example: wikipedia (encyclopedia articles), commons (images, audio, and video), wiktionary (dictionary entries). List all projects.
|
language
required path |
Language code. For example: ar (Arabic), en (English), es (Spanish). List supported languages.
|
id
required path |
Revision identifier |
Responses
200 | Success: Revision found. Returns a revision.
Example
{
"id": 983392678,
"page": {
"id": 9228,
"title": "Earth"
},
"size": 174533,
"minor": true,
"timestamp": "2020-10-14T00:23:50Z",
"user": {
"id": 28903366,
"name": "Bender the Bot"
},
"comment": "/* References */HTTP → HTTPS for [[Wayback Machine]], replaced: http://web.archive.org/ → https://web.archive.org/",
"delta": 1
}
|
---|---|
404 | Error: Revision not found
Example
{
"messageTranslations": {
"en": "The specified revision does not exist"
},
"httpCode": 404,
"httpReason": "Not Found"
}
|