次の方法で共有


Digital Platform API - 郵便番号サービス

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

警告

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

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

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

REST API

HTTP メソッド エンドポイント 説明
GET https://api.appnexus.com/postal-code 改ページを使用して、すべての郵便番号を表示します。
GET - https://api.appnexus.com/postal-code?min_last_modified=LAST_MODIFIED
- https://api.appnexus.com/postal-code?max_last_modified=LAST_MODIFIED
最終更新日以降のすべての郵便番号を表示します。
GET https://api.appnexus.com/postal-code?country_code=COUNTRY_CODE 特定の国/地域の郵便番号を表示します。
GET https://api.appnexus.com/postal-code/meta フィルター処理および並べ替えの対象となるフィールドを確認します。

JSON フィールド

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

注:
郵便番号は、IP アドレス指定や位置情報テクノロジの変更、および地理的境界の変更に基づいて、アクティブまたは非アクティブになる場合があります。

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

$ curl -b cookies -c cookies -X GET  'https://api.appnexus.com/postal-code'
      
{
    "response": {
        "status": "OK",
        "count": 238899,
        "start_element": 0,
        "num_elements": 100,
        "postal_codes": [
            {
                "id": 120560,
                "code": "AD100",
                "country_id": "4",
                "country_code": "AD",
                "country_name": "Andorra"
            },
            {
                "id": 120561,
                "code": "AD200",
                "country_id": "4",
                "country_code": "AD",
                "country_name": "Andorra"
            },
            {
                "id": 120562,
                "code": "AD300",
                "country_id": "4",
                "country_code": "AD",
                "country_name": "Andorra"
            },
            {
                "id": 120563,
                "code": "AD400",
                "country_id": "4",
                "country_code": "AD",
                "country_name": "Andorra"
            },
            {
                "id": 120564,
                "code": "AD500",
                "country_id": "4",
                "country_code": "AD",
                "country_name": "Andorra"
            },
            {
                "id": 120565,
                "code": "AD600",
                "country_id": "4",
                "country_code": "AD",
                "country_name": "Andorra"
            },
            {
                "id": 120566,
                "code": "AD700",
                "country_id": "4",
                "country_code": "AD",
                "country_name": "Andorra"
            },
            {
                "id": 173241,
                "code": "1701",
                "country_id": "6",
                "country_code": "AF",
                "country_name": "Afghanistan"
            },
            {
                "id": 173242,
                "code": "3001",
                "country_id": "6",
                "country_code": "AF",
                "country_name": "Afghanistan"
            },
            ...
       ]
    }
}

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

$ curl -b cookies -c cookies -X GET  'https://api.appnexus.com/postal-code?min_last_modified=2016-05-18+15:29:37'
      
{
    "response": {
        "status": "OK",
        "count": 247890,
        "start_element": 0,
        "num_elements": 100,
        "postal_codes": [
            {
                "id": 1,
                "code": "00010",
                "active": true,
                "country_id": "113",
                "country_code": "IT",
                "country_name": "Italy",
                "last_modified": "2015-09-15 14:40:30"
            },
            {
                "id": 2,
                "code": "00011",
                "active": true,
                "country_id": "113",
                "country_code": "IT",
                "country_name": "Italy",
                "last_modified": "2015-09-15 14:40:32"
            },
            {
                "id": 3,
                "code": "00012",
                "active": true,
                "country_id": "113",
                "country_code": "IT",
                "country_name": "Italy",
                "last_modified": "2015-09-15 17:29:04"
            },
            {
                "id": 4,
                "code": "00013",
                "active": true,
                "country_id": "113",
                "country_code": "IT",
                "country_name": "Italy",
                "last_modified": "2015-09-15 17:29:04"
            },
            {
                "id": 5,
                "code": "00015",
                "active": true,
                "country_id": "113",
                "country_code": "IT",
                "country_name": "Italy",
                "last_modified": "2015-09-15 17:29:05"
            },
            {
                "id": 6,
                "code": "00017",
                "active": true,
                "country_id": "113",
                "country_code": "IT",
                "country_name": "Italy",
                "last_modified": "2015-09-15 17:29:05"
            },
            {
                "id": 7,
                "code": "00018",
                "active": true,
                "country_id": "113",
                "country_code": "IT",
                "country_name": "Italy",
                "last_modified": "2015-09-15 17:29:05"
            },
            ...
       ]
    }
}

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

$ curl -b cookies -c cookies -X GET  'https://api.appnexus.com/postal-code?country_code=CA'
      
{
    "response": {
        "status": "OK",
        "count": 44101,
        "start_element": 0,
        "num_elements": 100,
        "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": 119895,
                "code": "A0A 1B0",
                "country_id": "41",
                "country_code": "CA",
                "country_name": "Canada"
            },
            {
                "id": 119896,
                "code": "A0A 1C0",
                "country_id": "41",
                "country_code": "CA",
                "country_name": "Canada"
            },
            {
                "id": 119897,
                "code": "A0A 1E0",
                "country_id": "41",
                "country_code": "CA",
                "country_name": "Canada"  
        },
        ...
      ],
   }
}

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

$ curl -b cookies -c cookies  'https://api.appnexus.com/postal-code?id=10'
      
{
    "response": {
        "status": "OK",
        "count": 1,
        "start_element": 0,
        "num_elements": 100,
        "postal_code": {
            "id": 10,
            "code": "00021",
            "country_id": "113",
            "country_code": "IT",
            "country_name": "Italy",
            "last_modified": "2015-09-15 17:29:05"
        }
    }
    }