Export translations
Jump to navigation
Jump to search
Settings
Group
Birthday Bash
Capital
Card Game
Combat System
Expansion
Fake
Halloween Hunt
Influence
Kingdom
Kingdoms API
Main Page
Menhir
NPC (Kingdoms)
Oasis (Kingdoms)
Robbers
Speed Settling
Starvation
Template:Kingdoms Topic
Template:Legends Kingdoms Topic
Template:Main
Template:TKServerSetup
Treasures
Treasury (Kingdoms)
Tributes
Victory Points (Kingdoms)
Wonder of the World (Kingdoms)
Language
aa - Afar
ab - Abkhazian
abs - Ambonese Malay
ace - Achinese
ady - Adyghe
ady-cyrl - Adyghe (Cyrillic script)
aeb - Tunisian Arabic
aeb-arab - Tunisian Arabic (Arabic script)
aeb-latn - Tunisian Arabic (Latin script)
af - Afrikaans
ak - Akan
aln - Gheg Albanian
am - Amharic
an - Aragonese
ang - Old English
anp - Angika
ar - Arabic
arc - Aramaic
arn - Mapuche
arq - Algerian Arabic
ary - Moroccan Arabic
arz - Egyptian Arabic
as - Assamese
ase - American Sign Language
ast - Asturian
atj - Atikamekw
av - Avaric
avk - Kotava
awa - Awadhi
ay - Aymara
az - Azerbaijani
azb - South Azerbaijani
ba - Bashkir
ban - Balinese
bar - Bavarian
bbc - Batak Toba
bbc-latn - Batak Toba (Latin script)
bcc - Southern Balochi
bcl - Central Bikol
be - Belarusian
be-tarask - Belarusian (Taraškievica orthography)
bg - Bulgarian
bgn - Western Balochi
bh - Bhojpuri
bho - Bhojpuri
bi - Bislama
bjn - Banjar
bm - Bambara
bn - Bangla
bo - Tibetan
bpy - Bishnupriya
bqi - Bakhtiari
br - Breton
brh - Brahui
bs - Bosnian
btm - Batak Mandailing
bto - Iriga Bicolano
bug - Buginese
bxr - Russia Buriat
ca - Catalan
cbk-zam - Chavacano
cdo - Min Dong Chinese
ce - Chechen
ceb - Cebuano
ch - Chamorro
cho - Choctaw
chr - Cherokee
chy - Cheyenne
ckb - Central Kurdish
co - Corsican
cps - Capiznon
cr - Cree
crh - Crimean Turkish
crh-cyrl - Crimean Tatar (Cyrillic script)
crh-latn - Crimean Tatar (Latin script)
cs - Czech
csb - Kashubian
cu - Church Slavic
cv - Chuvash
cy - Welsh
da - Danish
de - German
de-at - Austrian German
de-ch - Swiss High German
de-formal - German (formal address)
din - Dinka
diq - Zazaki
dsb - Lower Sorbian
dtp - Central Dusun
dty - Doteli
dv - Divehi
dz - Dzongkha
ee - Ewe
egl - Emilian
el - Greek
eml - Emiliano-Romagnolo
en - English
en-ca - Canadian English
en-gb - British English
eo - Esperanto
es - Spanish
es-419 - Latin American Spanish
es-formal - español (formal)
et - Estonian
eu - Basque
ext - Extremaduran
fa - Persian
ff - Fulah
fi - Finnish
fit - Tornedalen Finnish
fj - Fijian
fo - Faroese
fr - French
frc - Cajun French
frp - Arpitan
frr - Northern Frisian
fur - Friulian
fy - Western Frisian
ga - Irish
gag - Gagauz
gan - Gan Chinese
gan-hans - Gan (Simplified)
gan-hant - Gan (Traditional)
gcr - Guianan Creole
gd - Scottish Gaelic
gl - Galician
glk - Gilaki
gn - Guarani
gom - Goan Konkani
gom-deva - Goan Konkani (Devanagari script)
gom-latn - Goan Konkani (Latin script)
gor - Gorontalo
got - Gothic
grc - Ancient Greek
gsw - Swiss German
gu - Gujarati
gv - Manx
ha - Hausa
hak - Hakka Chinese
haw - Hawaiian
he - Hebrew
hi - Hindi
hif - Fiji Hindi
hif-latn - Fiji Hindi (Latin script)
hil - Hiligaynon
ho - Hiri Motu
hr - Croatian
hrx - Hunsrik
hsb - Upper Sorbian
ht - Haitian Creole
hu - Hungarian
hu-formal - magyar (formal)
hy - Armenian
hyw - Western Armenian
hz - Herero
ia - Interlingua
id - Indonesian
ie - Interlingue
ig - Igbo
ii - Sichuan Yi
ik - Inupiaq
ike-cans - Eastern Canadian (Aboriginal syllabics)
ike-latn - Eastern Canadian (Latin script)
ilo - Iloko
inh - Ingush
io - Ido
is - Icelandic
it - Italian
iu - Inuktitut
ja - Japanese
jam - Jamaican Creole English
jbo - Lojban
jut - Jutish
jv - Javanese
ka - Georgian
kaa - Kara-Kalpak
kab - Kabyle
kbd - Kabardian
kbd-cyrl - Kabardian (Cyrillic script)
kbp - Kabiye
kg - Kongo
khw - Khowar
ki - Kikuyu
kiu - Kirmanjki
kj - Kuanyama
kjp - Eastern Pwo
kk - Kazakh
kk-arab - Kazakh (Arabic script)
kk-cn - Kazakh (China)
kk-cyrl - Kazakh (Cyrillic script)
kk-kz - Kazakh (Kazakhstan)
kk-latn - Kazakh (Latin script)
kk-tr - Kazakh (Turkey)
kl - Kalaallisut
km - Khmer
kn - Kannada
ko - Korean
ko-kp - Korean (North Korea)
koi - Komi-Permyak
kr - Kanuri
krc - Karachay-Balkar
kri - Krio
krj - Kinaray-a
krl - Karelian
ks - Kashmiri
ks-arab - Kashmiri (Arabic script)
ks-deva - Kashmiri (Devanagari script)
ksh - Colognian
ku - Kurdish
ku-arab - Kurdish (Arabic script)
ku-latn - Kurdish (Latin script)
kum - Kumyk
kv - Komi
kw - Cornish
ky - Kyrgyz
la - Latin
lad - Ladino
lb - Luxembourgish
lbe - Lak
lez - Lezghian
lfn - Lingua Franca Nova
lg - Ganda
li - Limburgish
lij - Ligurian
liv - Livonian
lki - Laki
lmo - Lombard
ln - Lingala
lo - Lao
loz - Lozi
lrc - Northern Luri
lt - Lithuanian
ltg - Latgalian
lus - Mizo
luz - Southern Luri
lv - Latvian
lzh - Literary Chinese
lzz - Laz
mai - Maithili
map-bms - Basa Banyumasan
mdf - Moksha
mg - Malagasy
mh - Marshallese
mhr - Eastern Mari
mi - Maori
min - Minangkabau
mk - Macedonian
ml - Malayalam
mn - Mongolian
mni - Manipuri
mnw - Mon
mo - Moldovan
mr - Marathi
mrj - Western Mari
ms - Malay
mt - Maltese
mus - Creek
mwl - Mirandese
my - Burmese
myv - Erzya
mzn - Mazanderani
na - Nauru
nah - Nāhuatl
nan - Min Nan Chinese
nap - Neapolitan
nb - Norwegian Bokmål
nds - Low German
nds-nl - Low Saxon
ne - Nepali
new - Newari
ng - Ndonga
niu - Niuean
nl - Dutch
nl-informal - Nederlands (informeel)
nn - Norwegian Nynorsk
no - Norwegian
nov - Novial
nrm - Norman
nso - Northern Sotho
nv - Navajo
ny - Nyanja
nys - Nyungar
oc - Occitan
olo - Livvi-Karelian
om - Oromo
or - Odia
os - Ossetic
pa - Punjabi
pag - Pangasinan
pam - Pampanga
pap - Papiamento
pcd - Picard
pdc - Pennsylvania German
pdt - Plautdietsch
pfl - Palatine German
pi - Pali
pih - Norfuk / Pitkern
pl - Polish
pms - Piedmontese
pnb - Western Punjabi
pnt - Pontic
prg - Prussian
ps - Pashto
pt - Portuguese
pt-br - Brazilian Portuguese
qqq - Message documentation
qu - Quechua
qug - Chimborazo Highland Quichua
rgn - Romagnol
rif - Riffian
rm - Romansh
rmy - Vlax Romani
rn - Rundi
ro - Romanian
roa-tara - Tarantino
ru - Russian
rue - Rusyn
rup - Aromanian
ruq - Megleno-Romanian
ruq-cyrl - Megleno-Romanian (Cyrillic script)
ruq-latn - Megleno-Romanian (Latin script)
rw - Kinyarwanda
sa - Sanskrit
sah - Sakha
sat - Santali
sc - Sardinian
scn - Sicilian
sco - Scots
sd - Sindhi
sdc - Sassarese Sardinian
sdh - Southern Kurdish
se - Northern Sami
sei - Seri
ses - Koyraboro Senni
sg - Sango
sgs - Samogitian
sh - Serbo-Croatian
shi - Tachelhit
shi-latn - Tachelhit (Latin script)
shi-tfng - Tachelhit (Tifinagh script)
shn - Shan
shy-latn - Shawiya (Latin script)
si - Sinhala
simple - Simple English
sk - Slovak
skr - Saraiki
skr-arab - Saraiki (Arabic script)
sl - Slovenian
sli - Lower Silesian
sm - Samoan
sma - Southern Sami
sn - Shona
so - Somali
sq - Albanian
sr - Serbian
sr-ec - Serbian (Cyrillic script)
sr-el - Serbian (Latin script)
srn - Sranan Tongo
ss - Swati
st - Southern Sotho
stq - Saterland Frisian
sty - cебертатар
su - Sundanese
sv - Swedish
sw - Swahili
szl - Silesian
ta - Tamil
tay - Tayal
tcy - Tulu
te - Telugu
tet - Tetum
tg - Tajik
tg-cyrl - Tajik (Cyrillic script)
tg-latn - Tajik (Latin script)
th - Thai
ti - Tigrinya
tk - Turkmen
tl - Tagalog
tly - Talysh
tn - Tswana
to - Tongan
tpi - Tok Pisin
tr - Turkish
tru - Turoyo
ts - Tsonga
tt - Tatar
tt-cyrl - Tatar (Cyrillic script)
tt-latn - Tatar (Latin script)
tum - Tumbuka
tw - Twi
ty - Tahitian
tyv - Tuvinian
tzm - Central Atlas Tamazight
udm - Udmurt
ug - Uyghur
ug-arab - Uyghur (Arabic script)
ug-latn - Uyghur (Latin script)
uk - Ukrainian
ur - Urdu
uz - Uzbek
uz-cyrl - Uzbek (Cyrillic script)
uz-latn - Uzbek (Latin script)
ve - Venda
vec - Venetian
vep - Veps
vi - Vietnamese
vls - West Flemish
vmf - Main-Franconian
vo - Volapük
vot - Votic
vro - Võro
wa - Walloon
war - Waray
wo - Wolof
wuu - Wu Chinese
xal - Kalmyk
xh - Xhosa
xmf - Mingrelian
xsy - Saisiyat
yi - Yiddish
yo - Yoruba
yue - Cantonese
za - Zhuang
zea - Zeelandic
zgh - Standard Moroccan Tamazight
zh - Chinese
zh-cn - Chinese (China)
zh-hans - Simplified Chinese
zh-hant - Traditional Chinese
zh-hk - Chinese (Hong Kong)
zh-mo - Chinese (Macau)
zh-my - Chinese (Malaysia)
zh-sg - Chinese (Singapore)
zh-tw - Chinese (Taiwan)
zu - Zulu
Format
Export for off-line translation
Export in native format
Fetch
{{DISPLAYTITLE:Kingdoms API}}<languages/> {{Kingdoms Topic/en|legends=Legends API}} Travian provides a [https://en.wikipedia.org/wiki/JSON JSON]-[https://en.wikipedia.org/wiki/Application_programming_interface API] to access some information about running game worlds.<ref>https://forum.kingdoms.com/index.php?thread/4099-api-for-external-tools/</ref><ref>https://forum.kingdoms.com/index.php?thread/21440-official-api-for-external-tools/&postID=149851#post149851</ref> == Accessing the API == The base URL for all queries to the API is <pre>https://<gameworld>.kingdoms.com/api/external.php?action=<action></pre> (e.g. https:<nowiki />//com1.kingdoms.com/api/external.php?action=...). === Parameters === Depending on the value of ''action'' further parameters have to be specified. For most requests an [[#Action: requestApiKey |API key]] is required. === Response format === ╠═ time : int? : [https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date#The_ECMAScript_epoch_and_timestamps javascript timestamp] (miliseconds since January 1, 1970, UTC), only present for some actions ╠═ error : object? : Indicates that an error occured. ''response'' will contain an empty array in this case. ╠═ type : string ╠═ number : int : error id ╚═ message : string ╚═ response : object | empty array A question mark after a type indicates that this property is optional. ''object'' refers to the JSON meaning of the term (similar to dictionaries or maps in other languages). In the following sections, only the contents of the response object are shown. ''string(≤255)'' resp. ''string(32)'' indicates a string with a maximum resp. fixed length. The type ''string(int)'' represents an integer that is formatted as a JSON string (surrounded by ") for unknown reasons. == Action: requestApiKey == An API key can be requested using this action. The key is required for most other requests. === Parameters === {| class="wikitable" | email || string(≤255) || valid email address (may be used by Travian staff for questions) |- | siteName || string(≤255) || name of the tool |- | siteUrl || string(≤255) || URL of the tool |- | public || boolean || whether the tool should be available to the public (and may be used by Travian to create e.g. a tool list in the future) |} === Response === ╚═ response ╠═ privateApiKey : string(32) ╚═ publicSiteKey : string(32) == Action: updateSiteData == This action can be used to update the data that was provided in the original ''requestApiKey'' request. === Parameters === {| class="wikitable" | privateApiKey || string(32) || private api key |- | email || string(≤255) || valid email address (may be used by Travian staff for questions) |- | siteName || string(≤255) || name of the tool |- | siteUrl || string(≤255) || URL of the tool |- | public || boolean || whether the tool should be available to the public (and may be used by Travian to create e.g. a tool list in the future) |} === Response === ╚═ response ╚═ data : boolean : always true (in case of an error, an error object is used instead as descried [[#Response_format|above]]) == Action: getMapData == The response to this action contains all available data including information about players, kingdoms and the map. === Parameters === {| class="wikitable" | privateApiKey || string(32) || private api key |- | date || string? || may be specified to request old data, the newest available data is returned if omitted, format is DD.MM.YYYY (e.g. 31.12.2020) |} The API has a bug when querying map data near midnight that leads to data for the wrong day getting returned.<ref>https://forum.kingdoms.com/index.php?thread/20863-suggestions-for-the-json-api/&postID=144462#post144462</ref> === Response === ╚═ response ╠═ gameworld : object ╠═ name : string : (e.g. "com1") ╠═ startTime : int : unix timestamp ('''seconds''' since January 1, 1970, UTC) ╠═ speed : int ╠═ speedTroops : int ╠═ lastUpdateTime : string(int) : unix timestamp, exact timestamp when returned data was generated ╠═ date : int : unix timestamp, start of the day (00:00:00) of returned data ╚═ version : string : always "1.0" ╠═ players : array ╠═ playerId : string(int) ╠═ name : string ╠═ tribeId : string(int) : 1 = Roman, 2 = Teuton, 3 = Gaul ╠═ kingdomId : string(int) : "0" for no kingdom ╠═ treasures : int : if player is king, then number of treasures of the kingdom, otherwise 0 ╠═ role : int : 0 = Governor, 1 = King, 2 = Duke, 3 = Vice King, 0 if not part of any kingdom ╠═ externalLoginToken : string : see [[#Authentication using publicSiteKey|Authentication using publicSiteKey]] ╚═ villages : array ╠═ villageId : string(int) ╠═ x : string(int) ╠═ y : string(int) ╠═ population : string(int) ╠═ name : string ╠═ isMainVillage : boolean ╚═ isCity : boolean ╠═ kingdoms : array ╠═ kingdomId : string(int) ╠═ kingdomTag : string : name of the kingdom ╠═ creationTime : string(int) : unix timestamp, exact time of kingdom creation ╚═ victoryPoints : string(int) ╚═ map ╠═ radius : string(int) : current radius of the map ╠═ cells : array ╠═ id : string(int) ╠═ x : string(int) ╠═ y : string(int) ╠═ resType : string : if cell is an abandoned valley or village, then resource distribution (e.g. "4446"), otherwise "0" = wilderness, "1" = outside of map radius ╠═ oasis : string(int) : if cell is an oasis, then [[#Oases oasis type], otherwise "0" ╠═ landscape : string(int) : landscape id, see [[#Landscapes|Landscapes]] ╚═ kingdomId : string(int) / int : kingdom id (as string) of the village ('''not''' kingdom of the village's owner), 0 (as int) if not within kingdom borders ╚═ landscapes : object ╚═ [ landscape id : int ] : string : relative path to the corresponding image (e.g. "layout/images/map/wood0_0_0.png"), see [[#Landscapes|Landscapes]] ==== Oases ==== An oasis type consists of 2 digits. The first determines the main resource of the oasis according to the table below. If the second digit is a 1 the oasis has an addition 25% crop bonus, otherwise there is no secondary bonus. {| class="wikitable" ! ID !! Type |- | 1 || wood |- | 2 || clay |- | 3 || iron |- | 4 || crop |} Examples: "20" is a 25% clay oasis. "21" is a 25% clay and 25% crop oasis. "41" is a 50% crop oasis. ==== Landscapes ==== Landscapes are the visualizations used on the ingame map (e.g. trees, mountains, lakes, clay pits). A landscape's id can be mapped to an image path using the ''landscapes'' object in the response. This path is relative to the static game files which can be found at https://cdn.traviantools.net/game/0.95/ for that specific version of the game. Example path: https://cdn.traviantools.net/game/0.95/layout/images/map/wood0_0_0.png == Authentication using publicSiteKey == From https://forum.kingdoms.com/index.php?thread/4099-api-for-external-tools/: <blockquote> With the ''externalLoginToken'' you can authenticate a player - without that the player needs to register for your tool. In your call to ''requestApiKey'' you were provided a ''privateApiKey'' and a ''publicSiteKey''. The ''privateApiKey'' should be.. guess what.. private. You shouldn't tell this to anyone. You will need it to make requests to our api's. In contrast your ''publicSiteKey'' can be public. If a player wants to log-in to your site, he needs first an ''accessToken'' for your site. The player needs your ''publicSiteKey''. The player can go to its Settings-Page in T5 and under point "External Tools" click on "Create Access". He enters your ''publicSiteKey'' and get an ''accessToken'' back. If the player enters the ''accessToken'' on your site, you can calculate the players ''externalLoginToken'' by <pre>$externalLoginToken = md5($accessToken.$privateApiKey);</pre> Now you can search the player in your player table generated with the data from ''getMapData'' and - if you found him - log him into your site. </blockquote> == References == <references />
Navigation menu
Personal tools
English
Log in
Namespaces
Special page
Variants
Views
More
Search
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Tools
Special pages
Printable version