Getting Country Code

You can get the country code of requesting IP. When an IP exists in the requesting IP field, use the IP. If nothing exists, time zone service checks the requesting client IP to return the relevant country code.

  • Request URL
Common URL https://timezone.qpyou.cn/public/api/getCountryCodeByIp
Distributed Environment URL https://timezone.globalwithhive.com/public/api/getTimezone
Sandbox URL https://sandbox-timezone.qpyou.cn/public/api/getCountryCodeByIp
HTTP Method POST
Content-Type text/html
Data Format JSON
Note

The Time Zone API has a distributed processing environment in case of a failure or poor network. If the communication timeout set for your game server is exceeded due to a failure or network problem, call this API using the distributed environment URL.

  • Request
Field Name Description Required
ip If the requesting IP(IPv4 or IPv6) is null, it gets the country code through the IP of API-implementing client. N
  • Response
Field Name Description Type
result_code Result code. 0=Success Integer
result_msg Result message String
timezone Object-type time zone Refer to the following Timezone object Object
  • Timezone object
Field Name Description Type
country_code Country code based on the ISO 3166-1 alpha-2 String
  • Request Sample
//IPv4
{
    "ip" : "127.0.0.1"
}
//IPv6
{
    "ip" : "::ffff:dc46:52e7" or "0:0:0:0:0:ffff:dc46:52e7" or "0000:0000:0000:0000:0000:ffff:dc46:52e7"
}
  • Response Sample
{ 
"result_code":0,
"result_message":"Success",
"timezone" : {
         "country_code":"KR"
   } 
}
Note

When the country code of requesting IP is not identified, success is returned as result value, and "UNKNOWN" is returned as country_code value.

  • Response Sample in case IP unable to identify the time zone
{ 
"result_code":0,
"result_message":"Success",
"timezone" : {
         "country_code":"UNKNOWN"
   } 
}