GET | /core/v1/{project}/{language}/page/{title}/links/language
|
---|
Searches for pages with the same topic in different languages. Returns an array of language objects that include the name of the language, the language code, and the translated page title.
Examples
curl
# Find articles from other Wikipedias linked to the Earth article on English Wikipedia
$ curl https://api.wikimedia.org/core/v1/wikipedia/en/page/Earth/links/language
Python
# Python 3
# Find articles from other Wikipedias linked to the Earth article on English Wikipedia
import requests
page = 'Earth'
url = 'https://api.wikimedia.org/core/v1/wikipedia/en/page/' + page + '/links/language'
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
// Find articles from other Wikipedias linked to the Earth article on English Wikipedia
$url = 'https://api.wikimedia.org/core/v1/wikipedia/en/page/Earth/links/language';
$authorization = 'Authorization: Bearer YOUR_ACCESS_TOKEN';
$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
// Find articles from other Wikipedias linked to the Earth article on English Wikipedia
let url = 'https://api.wikimedia.org/core/v1/wikipedia/en/page/Earth/links/language';
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.
|
title
required path |
Wiki page title |
Responses
200 | Success: Languages found. Returns array of languages.
Example
[
{
"code": "ab",
"name": "Аҧсшәа",
"key": "Адгьыл",
"title": "Адгьыл"
},
{
"code": "ace",
"name": "Acèh",
"key": "Bumoë",
"title": "Bumoë"
},
{
"code": "ady",
"name": "адыгабзэ",
"key": "ЧIыгу",
"title": "ЧIыгу"
}
]
|
---|---|
404 | Error: Title not found
Example
{
"messageTranslations": {
"en": "The specified title does not exist"
},
"httpCode": 404,
"httpReason": "Not Found"
}
|