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 sample
accountApi.queryMyRegion().then(
(res) => {
console.log(res);
}
);
Response parameters
| Parameters | Type | Explanation |
|---|---|---|
| ret | number | Return code 0: Request successful !=0: Request failed, refer to msg for detailed results |
| msg | string | Result Explanation |
| alpha2 | string | Alpha 2 codes of countries or regions as per ISO 3166-1.For example, CN represents China, AT represents Austria. |
| region | string | ISO 3166-1 Numeric code for a country or region For example, 156 represents China, and 040 represents Austria |
| timestamp | number | Unix timestamp |
| seq | string | Data Stream Message Serial Number |
Response sample
{
ret: 0,
msg: "success",
alpha2: "HK",
region: "344",
seq: "1639128374-0343981578-017512-0000925611",
timestamp: 1639128374,
}