郵便番号 GraphQL仕様

APIエンドポイント

https://postcode.teraren.com/graphql

Examples

郵便番号一覧取得

キーワードを指定して該当する郵便番号の一覧を取得

Request

curl -s 'https://postcode.teraren.com/graphql' \
  -H 'content-type: application/json' \
  --data-raw '{"query":"{ postcodes(s: \"新宿\") { new, city, suburb }}"}' \
  --compressed -X POST -q | jq | head -n 20

Response

{
  "data": {
    "postcodes": [
      {
        "new": "9901441",
        "city": "西村山郡朝日町",
        "suburb": "新宿"
      },
      {
        "new": "3070042",
        "city": "結城市",
        "suburb": "江川新宿"
      },
      {
        "new": "3070034",
        "city": "結城市",
        "suburb": "新宿新田"
      }
    ]
  }
}

郵便番号取得

郵便番号を指定して該当する郵便番号を取得

Request

curl -s 'https://postcode.teraren.com/graphql' \
  -H 'content-type: application/json' \
  --data-raw '{"query":"{ postcode(new: \"1600023\") { new, city, suburb }}"}' \
  --compressed -X POST -q | jq

Response

{
  "data": {
    "postcode": {
      "new": "1600023",
      "city": "新宿区",
      "suburb": "西新宿"
    }
  }
}

建物一覧取得

建物名の一部を指定して該当する建物の一覧を取得

Request

curl -s 'https://postcode.teraren.com/graphql' \
  -H 'content-type: application/json' \
  --data-raw '{"query":"{ buildings(s: \"新宿\") { name }}"}' \
  --compressed -X POST -q | jq

Response

{
  "data": {
    "buildings": [
      {
        "name": "西新宿小田急第一生命ビル"
      },
      {
        "name": "西新宿新宿アイランドタワー"
      },
      {
        "name": "西新宿新宿NSビル"
      },
      {
        "name": "西新宿新宿エルタワー"
      },
      {
        "name": "西新宿新宿スクエアタワー"
      }
    ]
  }
}

建物取得

建物名を指定して建物を取得

Request

curl -s 'https://postcode.teraren.com/graphql' \
  -H 'content-type: application/json' \
  --data-raw '{"query":"{ building(name: \"西新宿小田急第一生命ビル\") { name }}"}' \
  --compressed -X POST -q | jq

Response

{
  "data": {
    "building": {
      "name": "西新宿小田急第一生命ビル"
    }
  }
}