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
| Parameters | Type | Explanation |
|---|---|---|
| ret | number | Return Code 0: Request Successful !=0: Request Failed, check msg for detailed results explanation |
| msg | String | Result explanation |
| alpha2 | String | ISO 3166-1 Alpha 2 code for country or region.E.g., CN represents China, AT represents Austria. |
| region | string | Numeric codes of countries or regions as per ISO 3166-1 For example, 156 represents China, and 040 represents Austria. |
| timestamp | number | Unix timestamp |
| seq | string | Data stream message sequence number |
Return Sample
{
ret: 0,
msg: "success",
alpha2: "HK",
region: "344",
seq: "1639128374-0343981578-017512-0000925611",
timestamp: 1639128374,
}