次の方法で共有


Bidders - 郵便番号サービス

郵便番号サービスは、読み取り専用サービスです。 このサービスを使用すると、広告申込情報を設定する場合や、そのディメンションをサポートするレポートを構成するときに、地域のターゲット設定のために Xandr に登録されている郵便番号 ID を取得できます。 郵便番号サービスのメインユース ケースは、郵便番号データベースを Xandr で最新の状態に保つことです。 サービスに対して行った最後の呼び出し以降に Xandr データベースに加えられた変更にアクセスするには、呼び出しで min_last_modified フィールドを使用してください。

警告

(改ページの結果として) 郵便番号の完全な一覧を取得するために行う必要がある GET 呼び出しの数が多いため、次のことをお勧めします。

  • キャッシュを作成し、サービス上のすべてのオブジェクトに対する GET 呼び出しを設定する
  • その後の GET 呼び出しでは、 min_last_modified フィルターを使用して更新プログラムを取得します (郵便番号は更新頻度が低いため、1 時間に 1 回、または 1 日に 1 回)。

このサービスに対して初めてクエリを実行する場合にのみ、 min_last_modified フィルターを省略する必要があります。

REST API

HTTP メソッド エンドポイント 説明
GET https://api.adnxs.com/postal-code すべての郵便番号を表示する
GET https://api.adnxs.com/postal-code?country_code=COUNTRY_CODE 特定の国または地域の郵便番号を表示する
GET https://api.adnxs.com/postal-code/meta フィルター処理および並べ替え可能なフィールドを確認する

JSON フィールド

フィールド 型 (長さ) 説明
active ブール値 郵便番号がアクティブかどうかを指定します。 true場合、郵便番号はアクティブであり、ターゲット設定に使用できます。 false場合、郵便番号の地理的位置データがないため、ターゲット設定はできません。
code string 郵便番号には、最大 14 文字の英数字文字列を使用でき、スペースまたはハイフンを含めることができます。
country_code string 市区町村が属する国または地域の ISO Alpha-2 コード。 Country Service を使用して、国コードの完全な一覧を取得できます。
country_id string 国または地域の ID。
country_name string 市区町村が属する国または地域の名前。 Country Service を使用して、国名の完全な一覧を取得できます。
id int 郵便番号の ID。
last_modified timestamp 郵便番号が最後に変更された日時。

カナダのすべての郵便番号を表示する

$ curl -b cookies -c cookies -X GET  'https://api.adnxs.com/postal-code?country_code=CA'
{
        "response": {
        "status": "OK",
        "count": 44101,
        "start_element": null,
        "num_elements": null,
        "postal_codes": [
            {
                "id": 119892,
                "code": "A09 0A1",
                "country_id": "41",
                "country_code": "CA",
                "country_name": "Canada"
            },
            {
                "id": 119893,
                "code": "A0A 0B3",
                "country_id": "41",
                "country_code": "CA",
                "country_name": "Canada"
            },
            {
                "id": 119894,
                "code": "A0A 0C3",
                "country_id": "41",
                "country_code": "CA",
                "country_name": "Canada"
            },
            ...
      ]
   }
}

郵便番号 ID で郵便番号を表示する

$ curl -b cookies -c cookies  'https://api.adnxs.com/postal-code?id=10'
      
{
    "response": {
        "status": "OK",
        "count": 1,
        "start_element": null,
        "num_elements": null,
        "postal_code": {
            "id": 10,
            "code": "00021",
            "country_id": "113",
            "country_code": "IT",
            "country_name": "Italy"
        }
    }
}

最終更新日以降のすべての郵便番号を表示する

$ curl -b cookies -c cookies -X GET  'https://api.adnxs.com/postal-code?min_last_modified=2017-06-28+15:02:37
{
    "response": {
        "status": "OK",
        "count": 8735,
        "start_element": null,
        "num_elements": null,
        "postal_codes": [{
            "id": 322567,
            "code": "2645-018",
            "active": true,
            "country_id": "186",
            "country_code": "PT",
            "country_name": "Portugal",
            "last_modified": "2017-06-26 15:39:18"
         },
         {
            "id": 322568,
            "code": "BS5 7XA",
            "active": true,
            "country_id": "80",
            "country_code": "GB",
            "country_name": "United Kingdom",
            "last_modified": "2017-06-26 15:39:18"
         },
         {
            "id": 322569,
            "code": "DE7 8HB",
            "active": true,
            "country_id": "80",
            "country_code": "GB",
            "country_name": "United Kingdom",
            "last_modified": "2017-06-26 15:39:18"
      },
      ...
    ]
  }
}