Skip to main content

Get Country Information Data (queryMyRegion)

queryMyRegion API is an IP-based country/region identification service that retrieves the corresponding country or region information based on the player's IP address.

Data source (https://www.ipip.net/accuracy.html) ensures data accuracy.

caution
  • Due to factors in the data source, the conversion between IP and region is not 100% accurate.
  • This API may fail to return result due to network jitter or other factors.It is not recommended to use it in critical game logic.Users must also consider the default adaptation strategy in case of failure.
  • The conversion relationship between IP and region will default to change as data is updated in the IP database.If a fixed conversion relationship between IP and region is needed, please contact Player Network Assistant.

Request Example

accountApi.queryMyRegion().then(
(res) => {
console.log(res);
}
);

Return parameters

ParametersTypeExplanation
retnumberReturn Code
0: Request Successful
!=0: Request Failed, check msg for detailed results explanation
msgStringResult explanation
alpha2StringISO 3166-1 Alpha 2 code for country or region.E.g., CN represents China, AT represents Austria.
regionstringNumeric codes of countries or regions as per ISO 3166-1
For example, 156 represents China, and 040 represents Austria.
timestampnumberUnix timestamp
seqstringData stream message sequence number

Return Sample

{
ret: 0,
msg: "success",
alpha2: "HK",
region: "344",
seq: "1639128374-0343981578-017512-0000925611",
timestamp: 1639128374,
}