タイムゾーンの取得
リクエストIPのタイムゾーン情報と国情報を取得します。リクエストボディのipフィールドに値がない場合、このAPIを呼び出しているIPのタイムゾーンと国情報が返されます。
- リクエストURL
| 共通URL | https://timezone.qpyou.cn/public/api/getTimezone | 
|---|---|
| 分散環境URL | https://timezone.globalwithhive.com/public/api/getTimezone | 
| サンドボックスURL | https://sandbox-timezone.qpyou.cn/public/api/getTimezone | 
| HTTPメソッド | POST | 
| Content-Type | text/html | 
| データ形式 | JSON | 
Note
タイムゾーンAPIは、障害やネットワークの問題が発生した場合に備えて、分散処理環境を持っています。ゲームサーバーの通信タイムアウトが障害やネットワークの問題により超過した場合は、分散環境のURLを使用してこのAPIを呼び出してください。
- リクエストボディ
| フィールド名 | 説明 | 必須 | 
|---|---|---|
| ip | リクエスト元のIP(IPv4またはIPv6)がnullの場合、APIを実装しているクライアントのIPを通じてタイムゾーンと国のデータを取得します。 | N | 
- 応答
| フィールド名 | 説明 | 必須 | 
|---|---|---|
| result_code | 結果コード。0=成功 | 整数 | 
| result_msg | 結果メッセージ | 文字列 | 
| timezone | オブジェクト型のタイムゾーン 次の**タイムゾーンオブジェクト**を参照 | オブジェクト | 
| country_diff | 
 | ブール値 | 
- タイムゾーンオブジェクト
| フィールド名 | 説明 | タイプ | 
|---|---|---|
| zone_id | タイムゾーンデータベースによって提供される位置識別子 | 文字列 | 
| country_code | ISO 3166-1 alpha-2に基づく国コード | 文字列 | 
| zone_name | 現地名 | 文字列 | 
| country_name | 国名 | 文字列 | 
| abbreviation | 国による標準時間の略称 | 文字列 | 
| gmt_offset | 時間差(単位:秒) | 文字列 | 
| dst | 夏時間の使用 | 文字列 | 
- リクエストサンプル
//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"
}
- レスポンスサンプル
//Example 1
{
     "result_code": 0,
     "result_message": "Success",
     "timezone": {
         "zone_id": "361",
         "country_code": "VN", //location-based country code
         "zone_name": "Asia/Bangkok", //name of timezone
         "country_name": "Vietnam",
         "abbreviation": "ICT",
         "gmt_offset": "25200",
         "dst": "0"
     },
     "country_diff": true //In the case of "Asia/Bangkok", the country code is TH, and the country code from IP geolocation is VN. Set to true because they are different to each other.
}
//Example 2
{
     "result_code": 0,
     "result_message": "Success",
     "timezone": {
         "zone_id": "212",
         "country_code": "KR", //location-based country code
         "zone_name": "Asia/Seoul", // Name of time zone
         "country_name": "Korea, Republic of",
         "abbreviation": "KST",
         "gmt_offset": "32400",
         "dst": "0"
     },
     "country_diff": false // In the case of "Asia/Seoul", the country code is KR and the country code from the IP geolocation is also KR, so set to false.
}
Note
リクエストIPのタイムゾーンが特定できない場合、成功が結果値として返され、"UNKNOWN"がcountry_code値として返されます。
- IPがタイムゾーンを特定できない場合のレスポンスサンプル