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
  • 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
  • Response Sample

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