RFC: Countries

Sort:
LegoPirateSenior

Yeah, I should've thought of that. Perhaps https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 is being used? Inquiring minds want to know...

skelos

I'd definitely like it documented, and that should be less work than a new endpoint. happy.png

Of course, country names change so perhaps "... standard as of YYYY-MM-DD" and bump the date if/when the standard changes and chess.com catch up.

Country names don't change often (he says optimistically) but as the wall came down and the USSR broke up I know one school librarian stopped buying atlases for at least a while!

LegoPirateSenior
LegoPirateSenior wrote:

Yeah, I should've thought of that. Perhaps https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 is being used? Inquiring minds want to know...

Nope, not these codes. According to the above page, Curacao should have code CW, but actually has code AN, which is reserved for Netherlands Antilles.

skelos

"The nice thing about standards is that you have so many to choose from." -- Andy Tanenbaum

LegoPirateSenior

Well, since no standard was identified, I brute-forced it. The table is too big to fit in one post, so it will take me a couple of trials to figure out how to split it...

 

Code

Country

Code

Country

Code

Country

Code

Country

AF

Afghanistan

SV

El Salvador

LT

Lithuania

SN

Senegal

AL

Albania

XE

England

LU

Luxembourg

RS

Serbia

DZ

Algeria

GQ

Equatorial Guinea

MO

Macao

SC

Seychelles

AS

American Samoa

ER

Eritrea

MK

Macedonia

SL

Sierra Leone

AD

Andorra

EE

Estonia

MG

Madagascar

SG

Singapore

AO

Angola

ET

Ethiopia

MW

Malawi

SK

Slovakia

AI

Anguilla

FK

Falkland Islands

MY

Malaysia

SI

Slovenia

AG

Antigua/Barbuda

FO

Faroe Islands

MV

Maldives

SB

Solomon Islands

AR

Argentina

FJ

Fiji

ML

Mali

SO

Somalia

AM

Armenia

FI

Finland

MT

Malta

ZA

South Africa

AW

Aruba

FR

France

MH

Marshall Islands

GS

South Georgia

AU

Australia

GA

Gabon

MQ

Martinique

KR

South Korea

AT

Austria

XG

Galicia

MR

Mauritania

SS

South Sudan

AZ

Azerbaijan

GM

Gambia

MU

Mauritius

ES

Spain

BS

Bahamas

GE

Georgia

MX

Mexico

LK

Sri Lanka

BH

Bahrain

DE

Germany

FM

Micronesia

SD

Sudan

BD

Bangladesh

GH

Ghana

MD

Moldova

SR

Suriname

BB

Barbados

GI

Gibraltar

MC

Monaco

SZ

Swaziland

XB

Basque Country

GR

Greece

MN

Mongolia

SE

Sweden

BY

Belarus

GL

Greenland

ME

Montenegro

CH

Switzerland

BE

Belgium

GD

Grenada

MS

Montserrat

SY

Syria

BZ

Belize

GP

Guadeloupe

MA

Morocco

TW

Taiwan

BJ

Benin

GU

Guam

MZ

Mozambique

TJ

Tajikistan

BM

Bermuda

GT

Guatemala

MM

Myanmar

TZ

Tanzania

BT

Bhutan

GG

Guernsey

NA

Namibia

TH

Thailand

BO

Bolivia

GN

Guinea

NR

Nauru

TL

Timor-Leste

BA

Bosnia-Herzegovina

GW

Guinea-Bissau

NP

Nepal

TG

Togo

BW

Botswana

GY

Guyana

NL

Netherlands

TO

Tonga

BR

Brazil

HT

Haiti

NC

New Caledonia

TT

Trinidad/Tobago

VG

British Virgin Islands

HN

Honduras

NZ

New Zealand

TN

Tunisia

 

LegoPirateSenior

 

Code

Country

Code

Country

Code

Country

Code

Country

BN

Brunei

HK

Hong Kong

NI

Nicaragua

TR

Turkey

BG

Bulgaria

HU

Hungary

NE

Niger

TM

Turkmenistan

BI

Burundi

IS

Iceland

NG

Nigeria

TV

Tuvalu

KH

Cambodia

IN

India

KP

North Korea

UG

Uganda

CM

Cameroon

ID

Indonesia

NO

Norway

UA

Ukraine

CA

Canada

XX

International

OM

Oman

AE

United Arab Emirates

XA

Canary Islands

IR

Iran

PK

Pakistan

GB

United Kingdom

CV

Cape Verde

IQ

Iraq

PW

Palau

US

United States

XC

Catalonia

IE

Ireland

XP

Palestine

UY

Uruguay

KY

Cayman Islands

IM

Isle of Man

PA

Panama

VI

US Virgin Islands

CF

Central Africa

IL

Israel

PG

Papua New Guinea

UZ

Uzbekistan

TD

Chad

IT

Italy

PY

Paraguay

VU

Vanuatu

CL

Chile

CI

Ivory Coast

PE

Peru

VA

Vatican City

CN

China

JM

Jamaica

PH

Philippines

VE

Venezuela

CO

Colombia

JP

Japan

PL

Poland

VN

Vietnam

KM

Comoros

JE

Jersey

PT

Portugal

XW

Wales

CG

Congo

JO

Jordan

PR

Puerto Rico

EH

Western Sahara

CR

Costa Rica

KZ

Kazakhstan

QA

Qatar

YE

Yemen

HR

Croatia

KE

Kenya

RO

Romania

ZM

Zambia

CU

Cuba

KI

Kiribati

RU

Russia

ZW

Zimbabwe

AN

Curacao

XK

Kosovo

RW

Rwanda

 

 

CY

Cyprus

KW

Kuwait

KN

Saint Kitts/Nevis

 

 

CZ

Czech Republic

KG

Kyrgyzstan

LC

Saint Lucia

 

 

DK

Denmark

LA

Laos

PM

Saint Pierre/Miquelon

 

 

DJ

Djibouti

LV

Latvia

VC

Saint Vincent

 

 

DM

Dominica

LB

Lebanon

WS

Samoa

 

 

DO

Dominican Republic

LS

Lesotho

SM

San Marino

 

 

CD

DR Congo

LR

Liberia

ST

Sao Tome/Principe

 

 

EC

Ecuador

LY

Libya

SA

Saudi Arabia

 

 

EG

Egypt

LI

Liechtenstein

XS

Scotland

 

 

 

LegoPirateSenior

Apologies for the weird blue artifact at the bottom of each table. Curiously, V2 displays these tables correctly. The tables were prepared in Numbers app on a Mac and pasted, using V3.

bcurtis
LegoPirateSenior wrote:
LegoPirateSenior wrote:

Yeah, I should've thought of that. Perhaps https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 is being used? Inquiring minds want to know...

Nope, not these codes. According to the above page, Curacao should have code CW, but actually has code AN, which is reserved for Netherlands Antilles.

 

This is indeed the standard we are using. It looks like you found a bug. I've created a ticket to fix it. Did you notice any others that are incorrect?

r000k

Sorry, new member here. I am not sure whether the country member list only includes the members that logged in the last 7 days, 2 days, 1 day (before the computation), it might be useful to have some way to parameterize it (otherwise I understand I should keep polling every day for the list, that's fine, there are other priorities). Just want to be sure what is the current default, as it has changed in the last few weeks.

Thanks!

bcurtis

No need to be sorry, @r000k! This is a great question and a good place for it. The answer is 1 day, but we don't use a 24 hour clock — anyone who logged in since midnight yesterday will be included. This is done to obtain reliable start times regardless of when the data are cached. It does mean that a single request might have 24–48 hours worth of players listed, and that's not predictable. The result is cached and will not change for 24 hours. In this way, if you poll the endpoint each day you will be guaranteed a complete list. You will not be able to deduplicate it (for example, if a person logged in earlier today they might be listed in both today's and tomorrow's data for just this one login), but you can verify this info more precisely for specific players on their player profile endpoint.

These specifics may change over time as our system gets fine tuned. When I can update the documentation, I will include this info there.

The current API has certain technical restrictions, and the results you get are more like flat files of data that database queries — parameters will not be supported in this version.

aliadoprimo

I wonder why Catalonia is in the country list and not Aragon, both are part of Spain.