smartystreets / smartystreets-ruby-sdk

The official client libraries for accessing SmartyStreets APIs from Ruby
https://smartystreets.com/docs/sdk/ruby
Apache License 2.0
23 stars 25 forks source link

International Autocomplete broken postal_code #35

Closed wonderer007 closed 2 years ago

wonderer007 commented 2 years ago

International Autocomplete API is returning 3 characters postal_code for Canada. While Canada postal code consist of six characters. It look like its missing last 3 characters. Please find my request and response JSON below

Request


{
  "parameters": {
    "search": "115 Strachan St",
    "country": "CAN",
    "license": "international-autocomplete-cloud",
    "auth-id": "AUTH-ID",
    "auth-token": "AUTH_TOKEN"
  },
  "payload": null,
  "url_prefix": "https://international-autocomplete.api.smartystreets.com/lookup",
  "referer": null,
  "headers": {
  },
  "content_type": "application/json"
}

Response

{
  "candidates": [
    {
      "street": "115 Strachan St",
      "locality": "Stratford",
      "administrative_area": "ON",
      "postal_code": "N5A",
      "country_iso3": "CAN"
    },
    {
      "street": "115 Strachan St",
      "locality": "Richmond",
      "administrative_area": "ON",
      "postal_code": "K0A",
      "country_iso3": "CAN"
    },
    {
      "street": "115 Strachan St",
      "locality": "Port Hope",
      "administrative_area": "ON",
      "postal_code": "L1A",
      "country_iso3": "CAN"
    },
    {
      "street": "115 Strachan St E",
      "locality": "Hamilton",
      "administrative_area": "ON",
      "postal_code": "L8L",
      "country_iso3": "CAN"
    }
  ]
}

Not: This isn't smartystreets-ruby-sdk gem issue rather smarty street API issue.

camiblanch commented 2 years ago

Currently, the Smarty International Address Autocomplete API will return incomplete postal codes if the match is only a street-level match, and not an actual address match. Smarty recognizes that, ideally, the API would only suggest fully valid addresses. It is something Smarty is aware of and working on.

The behavior you are seeing is as expected, although not ideal.